I posted the code sample that works for me on stack overflow to your question. It might be a problem with the type used during inserting the document you are searching for.
Op donderdag 6 maart 2014 12:39:37 UTC+1 schreef Isaac Hazan: > > Thx David. > > Sorry but I misunderstand(beginner in ES). > > Do you mean that the field names have been fed into ES as lower case? Or > the field values? > > Is this because of the “not analyzed”? > > Do I need to the “not analyzed” for a term query like I did? > > > > Thx a lot in advance. > > > > *From:* [email protected] <javascript:> [mailto: > [email protected] <javascript:>] *On Behalf Of *David Pilato > *Sent:* Thursday, March 06, 2014 1:24 PM > *To:* [email protected] <javascript:> > *Subject:* Re: Boolean query does not return expected data in > Elasticsearch > > > > Probably because of mapping. > > Everything has been indexed in lowercase and split into tokens... > > > > > > -- > > *David Pilato* | Technical Advocate | *Elasticsearch.com* > > @dadoonet <https://twitter.com/dadoonet> | > @elasticsearchfr<https://twitter.com/elasticsearchfr> > > > > > > Le 6 mars 2014 à 12:22:24, Isaac Hazan ([email protected]<javascript:>) > a écrit: > > I have the following document in Elasticsearch as reported by Kibana: > > > > {"deviceId":"C1976429369BFE063ED8B3409DB7C7E7D87196D9","appId":"DisneyDigitalBooks.PlanesAdventureAlbum","ostype":"iOS"} > > > > Why the following query does 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 is the response from Elasticsearch: > > > > { > > "took" : 1, > > "timed_out" : false, > > "_shards" : { > > "total" : 5, > > "successful" : 5, > > "failed" : 0 > > }, > > "hits" : { > > "total" : 0, > > "max_score" : null, > > "hits" : [ ] > > } > > } > > > > As a side question, is this the fastest way to query the data in my case? > > Thx in advance. > > UPDATE: Could it be related to the fact that I used the following mapping > for this 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"} > > } > > } > > } > > }' > > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/8e0cd982-8597-4b43-ab77-6e9245592ac7%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/8e0cd982-8597-4b43-ab77-6e9245592ac7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "elasticsearch" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elasticsearch/0_-C5jQeKOk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/etPan.53185add.649bb77c.7bfa%40MacBook-Air-de-David.local<https://groups.google.com/d/msgid/elasticsearch/etPan.53185add.649bb77c.7bfa%40MacBook-Air-de-David.local?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ffc42463-9662-41a3-b0a3-de33043f559f%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
