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

Allowing range queries with now ranges inside percolator queries #23921

Merged
merged 1 commit into from
Apr 7, 2017

Conversation

martijnvg
Copy link
Member

Before now ranges where forbidden, because the percolator query itself could get cached and then the percolator queries with now ranges that should no longer match, incorrectly will continue to match.
By disabling caching when the percolator is being used, the percolator can now correctly support range queries with now based ranges.

I think this is the right tradeoff. The percolator query is likely to not be the same between search requests and disabling range queries with now ranges really disabled people using the percolator for some of their use cases.

Also fixed an issue that existed in the percolator fieldmapper, it was unable to find forbidden queries inside dismax queries.

PR for #23859

@jpountz
Copy link
Contributor

jpountz commented Apr 5, 2017

Using instance equality is a bit dangerous since the query could still get cached if you run the same query instance multiple times. I think this is an ok risk given that we create new queries everytime, but I think we should have comments about it in the equals/hashCode methods.

@martijnvg
Copy link
Member Author

@jpountz Agreed. Added the comments. I basically looked at ScriptQuery and saw that we compare it in the same way also to avoid caching.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

… queries.

Before now ranges where forbidden, because the percolator query itself could get cached and then the percolator queries with now ranges that should no longer match, incorrectly will continue to match.
By disabling caching when the `percolator` is being used, the percolator can now correctly support range queries with now based ranges.

 I think this is the right tradeoff. The percolator query is likely to not be the same between search requests and disabling range queries with now ranges really disabled people using the percolator for their use cases.

 Also fixed an issue that existed in the percolator fieldmapper, it was unable to find forbidden queries inside `dismax` queries.

 Closes elastic#23859
@martijnvg martijnvg force-pushed the percolator_support_now_ranges branch from 7507a4a to 3d9671a Compare April 7, 2017 06:44
@martijnvg martijnvg merged commit 3d9671a into elastic:master Apr 7, 2017
@eliast
Copy link

eliast commented May 14, 2017

@martijnvg I'm wondering if I should be able to use ranges after this commit, but I'm still getting an IllegalArgumentException

https://discuss.elastic.co/t/allowing-range-queries-with-now-ranges-inside-percolator/85696

Any idea what else do I have to do?

martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request May 16, 2017
Range queries with now based date ranges were previously not allowed,
but since elastic#23921 these queries were allowed. This change should really
fix range queries with now based date ranges.
martijnvg added a commit that referenced this pull request May 16, 2017
Range queries with now based date ranges were previously not allowed,
but since #23921 these queries were allowed. This change should really
fix range queries with now based date ranges.
martijnvg added a commit that referenced this pull request May 16, 2017
Range queries with now based date ranges were previously not allowed,
but since #23921 these queries were allowed. This change should really
fix range queries with now based date ranges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Relevance/Percolator Reverse search: find queries that match a document v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants