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

Resolve now in date ranges in percolator and alias filters at search time instead of parse time #8534

Conversation

martijnvg
Copy link
Member

PR for #8474. Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a now expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment instead of during parse time. In the case of the range filter a special Resolvable Filter makes sure that now is resolved when the DocIdSet is pulled and in the case of the range query now is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Note this PR is against the 1.x branch.


@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
return resolve().getDocIdSet(context, acceptDocs);
Copy link
Contributor

Choose a reason for hiding this comment

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

can resolve possibly return null? if so we should check for it

@s1monw
Copy link
Contributor

s1monw commented Nov 19, 2014

left some comments

@s1monw s1monw self-assigned this Nov 19, 2014
@martijnvg
Copy link
Member Author

@s1monw I applied the feedback and left one comment.

@s1monw
Copy link
Contributor

s1monw commented Nov 19, 2014

LGTM

…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes elastic#8474
Closes elastic#8534
@martijnvg martijnvg changed the title Resolve now date ranges in percolator and alias filters at search time instead of parse time Resolve now in date ranges in percolator and alias filters at search time instead of parse time Nov 19, 2014
@martijnvg martijnvg force-pushed the bugs/alias_filter_and_percolator_query_with_now_based_range branch from 3dc311d to bba6560 Compare November 19, 2014 21:00
@martijnvg martijnvg merged commit bba6560 into elastic:1.x Nov 19, 2014
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 19, 2014
…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes elastic#8474
Closes elastic#8534
martijnvg added a commit that referenced this pull request Nov 19, 2014
…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes #8474
Closes #8534
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 19, 2014
…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes elastic#8474
Closes elastic#8534
@clintongormley clintongormley changed the title Resolve now in date ranges in percolator and alias filters at search time instead of parse time Query DSL: Resolve now in date ranges in percolator and alias filters at search time instead of parse time Nov 25, 2014
@martijnvg martijnvg deleted the bugs/alias_filter_and_percolator_query_with_now_based_range branch May 18, 2015 23:28
@clintongormley clintongormley changed the title Query DSL: Resolve now in date ranges in percolator and alias filters at search time instead of parse time Resolve now in date ranges in percolator and alias filters at search time instead of parse time Jun 7, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes elastic#8474
Closes elastic#8534
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…xecuted on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes elastic#8474
Closes elastic#8534
@clintongormley clintongormley added :Search/Mapping Index mappings, including merging and defining field types and removed :Dates labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Mapping Index mappings, including merging and defining field types v1.3.6 v1.4.1 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants