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

Use only filter context within queries #88

Open
wolfgang-s opened this issue Mar 8, 2017 · 0 comments
Open

Use only filter context within queries #88

wolfgang-s opened this issue Mar 8, 2017 · 0 comments

Comments

@wolfgang-s
Copy link

Sind we are never interested in the score of a document (How well does something match), all queries should execute as a filter.

Currently we do not use filter context, which makes the queries slow (and not cachable in memory)

https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-filter-context.html

My suggestions is to use
https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-dsl-constant-score-query.html

or
https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-dsl-bool-query.html
with "filter" or "must_not" -> but this is only for AND queries, no OR -> for findById for example

A simple change, and fast queries we could just replace (buildWhere function)

query: { bool: { must: [], should: [], must_not: [] } }

with

query: { constant_score: { filter: { bool: { must: [], should: [], must_not: [] } } } }

What do you think?
Supported since V1

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

No branches or pull requests

1 participant