Elasticsearch.org All About Elasticsearch Filter BitSets | Blog | Elasticsearch
When building queries in Elasticsearch, you'll often find yourself composing sets of filters. Say you need to filter users that are: Gender: Male Age: 23-26 Language: English Generally you should place these filters inside of a Boolean Filter . But wait…isn't there an And Filter ? What about the Or Filter and Not Filters ? Are they simply an alternative syntax to the Bool filter? The short answer is: No, they are very distinct. More importantly, they can have a big impact on your query performance. BitSets The key to understanding the difference will require a detour into BitSets. Fundamentally, a BitSet is just an array of bits that represent state. A position in the bit array is either a 1 or a 0. Filters don't score documents – they simply include or exclude. If a document matches a filter, it is represented with a one in the BitSet; otherwise a zero. This means that Elasticsearch can store an entire segment's filter state ("who matches this particular filter?Read full article from Elasticsearch.org All About Elasticsearch Filter BitSets | Blog | Elasticsearch
No comments:
Post a Comment