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
Properly propagate the search request context & headers to sub-requests #10979
Labels
Comments
uboness
added
>bug
:Search Templates
:Search/Search
Search-related issues that do not fall into other categories
labels
May 5, 2015
@spinscale please could you take a look when you have a moment |
checked the source, my current idea of implementing it is
Tricky: Testing this |
while we're at it, I'd just copy the headers as well.. why not |
Implementation note: Percolate-by-id must be supported as well |
spinscale
added a commit
to spinscale/elasticsearch
that referenced
this issue
May 8, 2015
Whenever a query parser (or any other component) issues another request as part of a request, the headers and the context has to be supplied as well. In order to do this, the `SearchContext` has to have those headers available, which in turn means, the shard level request needs to copy those from the original `SearchRequest` This commit introduces two new interface to supply the needed methods to work with context and headers. TODO * Validate this approach * PercolateContext is pretty dumb right now and just implements the methods without acting * Testing: Context testing is tricky, havent found a smart way so far Closes elastic#10979
spinscale
added a commit
to spinscale/elasticsearch
that referenced
this issue
May 15, 2015
Whenever a query parser (or any other component) issues another request as part of a request, the headers and the context has to be supplied as well. In order to do this, the `SearchContext` has to have those headers available, which in turn means, the shard level request needs to copy those from the original `SearchRequest` This commit introduces two new interface to supply the needed methods to work with context and headers. TODO * Validate this approach * PercolateContext is pretty dumb right now and just implements the methods without acting * Testing: Context testing is tricky, havent found a smart way so far Closes elastic#10979
spinscale
added a commit
to spinscale/elasticsearch
that referenced
this issue
May 18, 2015
Whenever a query parser (or any other component) issues another request as part of a request, the headers and the context has to be supplied as well. In order to do this, the `SearchContext` has to have those headers available, which in turn means, the shard level request needs to copy those from the original `SearchRequest` This commit introduces two new interface to supply the needed methods to work with context and headers. TODO * Validate this approach * PercolateContext is pretty dumb right now and just implements the methods without acting * Testing: Context testing is tricky, havent found a smart way so far Closes elastic#10979
spinscale
added a commit
to spinscale/elasticsearch
that referenced
this issue
May 18, 2015
Whenever a query parser (or any other component) issues another request as part of a request, the headers and the context has to be supplied as well. In order to do this, the `SearchContext` has to have those headers available, which in turn means, the shard level request needs to copy those from the original `SearchRequest` This commit introduces two new interface to supply the needed methods to work with context and headers. Closes elastic#10979
spinscale
added a commit
that referenced
this issue
May 18, 2015
Whenever a query parser (or any other component) issues another request as part of a request, the headers and the context has to be supplied as well. In order to do this, the `SearchContext` has to have those headers available, which in turn means, the shard level request needs to copy those from the original `SearchRequest` This commit introduces two new interface to supply the needed methods to work with context and headers. Closes #10979
clintongormley
added
:Search/Search
Search-related issues that do not fall into other categories
and removed
:Search Templates
labels
Feb 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Each transport request holds context and headers that represent the general context of the executed actions. There are actions that spawn other requests and we make sure that the context/headers of the original request is passed along to the sub-requests.
In the case of a search request, we have some cases where this context/headers passing doesn't happen and we need to fix that (we need to make sure the context & headers are not lost at any point in the execution). The reason for this today is that some spawned request simply don't have access to the original request. For example,
TermsLookup
used by the external terms filter executes a search during the parsing of the query. It has no access to the original search request that was executed and therefore cannot pass along the context & headers.To solve that we can use the
SearchContext
and let it hold the search request context & headers (maybe we can have theSearchContext
extendsContextHolder
). During the execution of a search, any phase that is part of the execution has access to the search context using the thread local basedSearchContext.current()
. We need to make sure, to set the request context & headers on theSearchContext
when it is created. From there on, we can extract these request context & headers everywhere we need to and pass it to the sub-request (a laTermsLookup
).Other sub request we need to look at:
MoreLikeThisQuery
GeoShapeFilter
andGeoShapeQuery
with a indexed shapeThe text was updated successfully, but these errors were encountered: