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

Parse aliases at search time and never cache parsed alias filters #11930

Merged

Conversation

martijnvg
Copy link
Member

This cleans up the alias code. The time spend on alias filter parsing is significantly lower compared to the execution time of a search request. Pre parsing alias filters and caching the parsed version at alias creation time isn't worth the effort (code complexity and memory).

Also:

  • This allows parent/child queries to be specified again in alias filters.
  • The work around for resolving now in queries doesn't need to be used for aliases, becuase alias filters are parsed at search time. However it can't be removed, because the percolator relies on it.

PR for #10485

@clintongormley
Copy link

@jpountz please could you review

@jpountz
Copy link
Contributor

jpountz commented Jun 30, 2015

Just discussed it with @martijnvg. With this pull request, we make use of two hacks in order to make sure that the parsed filter is what we expect:

  • new flags on QueryParseContext
  • build a first "dummy" query that only rewrites to the correct query

I like parsing aliases filters as late as possible, but I'm not happy with having both these hacks. It seems to me that we could make things work without adding more methods to QueryParseContext and just use the same rewrite hack that we use for date range queries.

@martijnvg martijnvg force-pushed the parse_alias_filters_at_search_time branch from 2c7bdf5 to 47f0cee Compare June 30, 2015 16:37
@martijnvg
Copy link
Member Author

@jpountz I updated the PR and used the dummy query hack in all places where last minute query parsing needs to happen.

@jpountz
Copy link
Contributor

jpountz commented Jun 30, 2015

LGTM

@martijnvg martijnvg force-pushed the parse_alias_filters_at_search_time branch 3 times, most recently from 91e5cd9 to f795f70 Compare July 1, 2015 18:39
…lters

The work around for resolving `now` doesn't need to be used for aliases, becuase alias filters are parsed at search time. However it can't be removed, because the percolator relies on it.

Parent/child can be specified again in alias filters, this now works again because alias filters are parsed at search time. Parent/child will also use the late query parse work around, to make sure to do the final preparations when the search context is around. This allows the aliases api to validate the parent/child queries without failing because there is no search context.

Closes elastic#10485
@martijnvg martijnvg force-pushed the parse_alias_filters_at_search_time branch from f795f70 to 53874bf Compare July 1, 2015 19:21
@martijnvg martijnvg merged commit 53874bf into elastic:master Jul 1, 2015
@kevinkluge kevinkluge removed the review label Jul 1, 2015
@clintongormley clintongormley added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Aliases labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >enhancement v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants