2017-10-29 129 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