I'm trying to optimize filter queries for performance and am slightly 
confused by the online docs.  Looking at:

1) https://www.elastic.co/blog/all-about-elasticsearch-filter-bitsets
2) 
http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-and-filter.html
3) 
http://www.elastic.co/guide/en/elasticsearch/guide/current/_filter_order.html

#1 says that Bool filter uses bitsets, while And/Or/Not does doc-by-doc 
matching.
#2 says that And result is optionally cacheable (implying that it uses 
bitsets).
#3 says that Bool does doc-by-doc matching if the inner filters are not 
cacheable.

This is confusing, is there a clear guideline on when bitsets are used?

Let's say I have two high-cardinality fields, x and y.  Field data for y is 
loaded into memory, while x is not.  What is the optimal way to structure 
this query?

      "filter": {
        "and": [
        {
          "term": {
            "x": "F828477AF7",
    "_cache": false  // Don't want to cache since query will not be repeated
          }
    },
{
  "range": {
            "y": {
                "gt": "CB70V63BD8AE  // String range query, should only be 
executed on result of previous filters
            }
          }
        }
        ]
      }

-- 
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/52dd306b-d229-462b-8b3c-b9cb2fff8c5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to