Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query DSL: Add different execution models for terms filter #1568

Closed
kimchy opened this issue Dec 23, 2011 · 7 comments
Closed

Query DSL: Add different execution models for terms filter #1568

kimchy opened this issue Dec 23, 2011 · 7 comments

Comments

@kimchy
Copy link
Member

kimchy commented Dec 23, 2011

The way terms filter currently executes is by iterating over the terms provided and finding matches docs (loading into a bitset) and caching it. Sometimes, we want a different execution model that can still be achieved by building more complex queries in the DSL, but would be nice to support them in the more compact model that terms filter provides.

The execution option now has the following options :

  • plain: The default. Works as today. Iterates over all the terms, building a bit set matching it, and filtering. The total filter is cached (keyed by the terms).
  • bool: Builds a bool filter wrapping each term in a term filter that is cached. The bool filter is optimized in this case since it bitwise or's the different term filter bitsets. The total filter is not cached by default in this case.
  • and: Builds an and filter wrapping each term in term filter that is cached. The total filter is not cached by default in this case. Most times, bool should be used as its faster thanks to its bitwise execution.

The "total" terms filter caching can still be explicitly controlled using the _cache option. Note the default value for it depends on the execution value.

@kimchy kimchy closed this as completed in 0ea58ca Dec 23, 2011
@medcl
Copy link
Contributor

medcl commented Dec 27, 2011

hi,shay,
looks great,any examples for this feature?

@kimchy
Copy link
Member Author

kimchy commented Dec 27, 2011

You mean how it looks like? Something like this:

{
    "terms" : { "field_name" : ["value1", "value2"], "execution" : "bool" }
}

@medcl
Copy link
Contributor

medcl commented Dec 27, 2011

thanks.

------------------ Original ------------------
From: "Shay Banon";
Date: 20111227(ڶ) 5:36
To: "Medcl";
Subject: Re: [elasticsearch] Query DSL: Add different execution models for terms filter (#1568)

You mean how it looks like? Something like this:

{
    "terms" : { "field_name" : ["value1", "value2"], "execution" : "bool" }
}

Reply to this email directly or view it on GitHub:
#1568 (comment)

@AndreKR
Copy link
Contributor

AndreKR commented Sep 4, 2014

What if I have a field named "execution"?

@clintongormley
Copy link

@AndreKR good point, i've opened #7629

@svnv
Copy link

svnv commented Sep 12, 2014

Does bool use must or should for the terms?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants