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

support filtered query #190

Open
newgene opened this issue Sep 27, 2021 · 3 comments
Open

support filtered query #190

newgene opened this issue Sep 27, 2021 · 3 comments
Assignees

Comments

@newgene
Copy link
Member

newgene commented Sep 27, 2021

When the order of the hits and _score values do not matter, the filtered query can be preferred. There are several ways to make such queries:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html#score-bool-filter

We can potentially support this by introducing a filter parameter, which takes the same parameter as q, but pass as the filtered query. It can be combined with q as the query part as well.

@newgene
Copy link
Member Author

newgene commented Sep 27, 2021

alternatively, we can reuse q parameter, but use an "as_filter" flag to indicate if the query should be queried as a filtered query or not. In this case, no combination of q and filter, can only do either one.

We can discuss to see which is preferred, or even support both.

@zcqian
Copy link
Contributor

zcqian commented Oct 5, 2021

Using the filter context may improve performance if it gets cached by Elasticsearch (which is, in the end, a maybe). Other than that, is there a specific reason that we would want to use the filter context instead of the query context?

In some cases we are already using both: for example in interval queries in MyVariant

@zcqian
Copy link
Contributor

zcqian commented Oct 5, 2021

Another thing is we can't make this opt-out, but it brings little benefit if it's opt-in.

The user making the query probably doesn't care about the performance impact of the query.

@zcqian zcqian assigned jal347 and unassigned zcqian Jan 5, 2022
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

3 participants