2017-10-29 97 views
0

我在elasticsearch中有4个文档。下面是它的外观像Elasticsearch匹配查询不起作用

enter image description here

我想查询只有在字Pythontitle提到的文件。我正在使用head插件,下面是我传递的GET命令。

enter image description here

然而,而不是让其中提到Python文档,我收到的所有文件。

{ 
"took": 8, 
"timed_out": false, 
"_shards": { 
"total": 5, 
"successful": 5, 
"failed": 0 
}, 
"hits": { 
"total": 4, 
"max_score": 1, 
"hits": [ 
{ 
"_index": "library", 
"_type": "book", 
"_id": "2", 
"_score": 1, 
"_source": { 
"title": "Building machine learning systems in JAVA", 
"publish_date": "July 2014", 
"price": 59.9 
} 
} 
, 
{ 
"_index": "library", 
"_type": "book", 
"_id": "4", 
"_score": 1, 
"_source": { 
"title": "Building machine learning systems in C++", 
"publish_date": "July 2016", 
"price": 79.9 
} 
} 
, 
{ 
"_index": "library", 
"_type": "book", 
"_id": "1", 
"_score": 1, 
"_source": { 
"title": "Building machine learning systems in Python", 
"publish_date": "July 2013", 
"price": 49.9 
} 
} 
, 
{ 
"_index": "library", 
"_type": "book", 
"_id": "3", 
"_score": 1, 
"_source": { 
"title": "Building machine learning systems in SCALA", 
"publish_date": "July 2015", 
"price": 69.9 
} 
} 
] 
} 
} 

不知道我很想念

+1

此答案可能有所帮助:https://stackoverflow.com/questions/34795053/es-keeps-returning-every-document/34796014#34796014 – Val

回答

1

它可能是由您使用的是发送请求的工具造成的。 GET经常不支持。改为使用POST

+0

谢谢!它确实有帮助。我会尝试更改我正在使用的工具。它奇怪的,虽然'PUT'命令工作非常好。 – Enthusiast

+1

PUT与身体支持 – dadoonet