Boolean query does not return expected data in Elasticsearch -
i have following document in elasticsearch reported kibana:
{"deviceid":"c1976429369bfe063ed8b3409db7c7e7d87196d9","appid":"disneydigitalbooks.planesadventurealbum","ostype":"ios"}
why following query not return success?
[root@myvm elasticsearch-1.0.0]# curl -xget 'http://localhost:9200/unique_app_install/_search?pretty=1' -d ' { "query" : { "bool" : { "must" : [ { "term" : { "deviceid" : "c1976429369bfe063ed8b3409db7c7e7d87196d9" } }, { "term" : { "appid" : "disneydigitalbooks.planesadventurealbum" } }, { "term" : { "ostype" : "ios" } } ] } } }'
here response elasticsearch:
{ "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }
as side question, fastest way query data in case?
thx in advance.
update: related fact used following mapping index?
curl -xpost localhost:9200/unique_app_install -d '{ "settings" : { "number_of_shards" : 5 }, "mappings" : { "sdk_sync" : { "properties" : { "deviceid" : { "type" : "string" , "index": "not_analyzed"}, "appid" : { "type" : "string" , "index": "not_analyzed"}, "ostype" : { "type" : "string" , "index": "not_analyzed"} } } } }'
check if type of document right while inserting: sdk_sync.
i have used items , me works. using following curl request give right response me:
curl -xpost localhost:9200/unique_app_install/sdk_sync/1 -d '{ "settings" : { "number_of_shards" : 5 }, "mappings" : { "sdk_sync" : { "properties" : { "deviceid" : { "type" : "string" , "index": "not_analyzed"}, "appid" : { "type" : "string" , "index": "not_analyzed"}, "ostype" : { "type" : "string" , "index": "not_analyzed"} } } } }' curl -xpost localhost:9200/unique_app_install/sdk_sync/1 -d '{ "deviceid":"c1976429369bfe063ed8b3409db7c7e7d87196d9", "appid":"disneydigitalbooks.planesadventurealbum", "ostype":"ios" }' curl -xget 'http://localhost:9200/unique_app_install/_search?pretty=1' -d ' { "query" : { "bool" : { "must" : [ { "term" : { "deviceid" : "c1976429369bfe063ed8b3409db7c7e7d87196d9" } }, { "term" : { "appid" : "disneydigitalbooks.planesadventurealbum" } }, { "term" : { "ostype" : "ios" } } ] } } }'
Comments
Post a Comment