Thx David.

I’ve read a few times the differences between query and filter and I do not 
fully grasp the difference.

Here is my understanding, a filter is a post processing logic on the data set 
resulted by a query? Is this right? Why would that be faster?

It is pointed in the doc that it is faster because it can be cached? I am not 
sure I understand that either, what is cached?

Is it the result set that is being cached?

 

For example let’s say I have a query that does “select deviceId,App from Mobile 
where Os = “android” and phone = “nexus” .

First I don’t know what to put in the query and what in the filter. But I 
suspect you might say that we should put in the filter the where clause?

Now if the next query I do:

“select deviceId,App from Mobile where Os = “android” -> without the phone field

This query will give a larger data set than the first, will the filter of the 
first help here?

In other terms If I have query that change dynamically, how the filter helps?

 

Thx a lot in advance. This would be super useful if I can get a clear 
explanation, I didn’t get one so far L.

 

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of David Pilato
Sent: Thursday, March 06, 2014 4:39 PM
To: [email protected]
Subject: RE: Boolean query does not return expected data in Elasticsearch

 

I meant field values.

But sorry I did not notice your mapping at the end.

The query sounds good.

 

Could you check your current mapping?

 

curl -XGET 'http://localhost:9200/unique_app_install/_mapping?pretty

 

To answer to the other question, fastest way would be to use post filters and 
not queries as you probably don't need to score here.

 

 

-- 

David Pilato | Technical Advocate | Elasticsearch.com

 <https://twitter.com/dadoonet> @dadoonet |  
<https://twitter.com/elasticsearchfr> @elasticsearchfr

 

 

Le 6 mars 2014 à 12:39:46, isaac hazan ([email protected]) a écrit:

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] [mailto:[email protected]] On 
Behalf Of David Pilato
Sent: Thursday, March 06, 2014 1:24 PM
To: [email protected]
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

 <https://twitter.com/dadoonet> @dadoonet |  
<https://twitter.com/elasticsearchfr> @elasticsearchfr

 

 

Le 6 mars 2014 à 12:22:24, Isaac Hazan ([email protected]) 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].
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].
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/00f101cf3930%24c346bc40%2449d434c0%24%40gmail.com
 
<https://groups.google.com/d/msgid/elasticsearch/00f101cf3930%24c346bc40%2449d434c0%24%40gmail.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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/etPan.53188897.61574095.7bfa%40MacBook-Air-de-David.local
 
<https://groups.google.com/d/msgid/elasticsearch/etPan.53188897.61574095.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/010901cf3965%24ad6b1530%2408413f90%24%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to