Enter some data in Elasticsearch
curl -XPUT 'localhost:9200/customer/external/1' -d '{ "author": "John", "published_from":"2016-08-03" }' curl -XPUT 'localhost:9200/customer/external/2' -d '{ "author": "Jeanne", "published_from":"2016-08-03" }' curl -XPUT 'localhost:9200/customer/external/3' -d '{ "author": "Jean", "published_from":"2016-08-05" }'
I am trying to request a document with publish_from = 2016-08-03 and author = John. I am trying to do this with this curl command:
curl -g "localhost:9200/customer/external/_search?pretty&filter_path=hits.hits._source.author&q=+author:John+published_from:2016-08-03"
However, the output shows Jeanne
{ "hits" : { "hits" : [ { "_source" : { "author" : "John" } }, { "_source" : { "author" : "Jeanne" } } ] } }
When I try to execute this curl command:
curl "localhost:9200/customer/external/_search?pretty&filter_path=hits.hits._source.author&q=%2Bauthor%3AJohn+%2Bpublished_from%3A2016-08-03"
The result is exactly what I want.
{ "hits" : { "hits" : [ { "_source" : { "author" : "John" } } ] } }
Why is the first command not working as expected?
curl elasticsearch lucene
g.lahlou
source share