-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Consistency between _search
and _msearch
#4227
Comments
yea, agreed, that would be nice to have |
Should _search be implemented internally via _msearch, in which case the two would never go out of sync? @Christoph and @martijnvg what do you think? |
cc @elastic/es-search-aggs |
Is this issue still active? I can't completely understand what is trying to be fixed and I'd like to work on it |
hi @pedromatt there hasn't been any activity on this issue for a long while. You are welcome to have a look at it. I had a quick look myself and I think that the first step was to double check if the issue still exists. The issue was initially opened because there were parameters that the search API supports, which were not supported as part of the msearch API. For instance |
each request building from original params
Looks like this issue has been around for a while and there's no activity on pull request from @vieirajlt for about 10 months either. I would like to see if I can still reproduce the issue in the latest version as @javanna suggested and submit a different PR if that's ok. I'm new to contributing to open source so this may take some time. |
So it does look like as of ES snapshot version 8, at least timeout and version are still not supported for _msearch
Does it look like a successful reproduction of the issue, or is there something more I need to check? |
heya @zacharymorn thanks for looking into this. Sounds like this still needs fixing. It may be worth to dig a bit deeper and see if there are other parameters that search supports which msearch does not. Looking at our rest spec for search and msearch may help here, see https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api. |
@javanna Sounds good & that's a good API reference link I can use in the future! I'm assuming you would like me to compare API support for both I also feel a good future-prove guard for this is to create a test case that consumes both specs and spit out any params inconsistency in the list, and actually execute all the APIs listed. This would require certain assumption such as params available for |
all makes sense, but not as trivial as it sounds :) especially the testing part as some params work only in some specific context. Also, it may be expected that some params are supported by search but not by msearch. Can you make a list and post it here so we can discuss it? |
Just in time! By comparing the only available in search.json:
only available in msearch.json:
|
heya @zacharymorn I am not sure that all these parameters make sense for msearch as global parameters. What I would focus on to start with is to check whether all of the search parameters are accepted and work properly as part of the msearch request body, as part of each search item. Unfortunately there is no spec for request/response bodies, hence it is really a matter of digging and testing. Once we have a full picture of what is missing we can think of what we want to address and how. |
Sounds good @javanna . I'm currently in the process of building up query body data to test those params. Will post update once I have some results. |
Hey @javanna I got back some initial result. I originally started with these commands that basically include all missing param in msearch request body
By try-and-eliminate one by one, a lot of them generated errors of the form:
which basically all come from After eliminating unsupported params, the minimum-viable-request-body and its response are something like this
I restarted the ES server so no document is left to match, but I think the response basically proved that those params are accepted in request body. The full list of params I eliminated is the following
I guess next step will be to actually index some more documents and see if the supported params actually work as expected? |
ok that would suggest that timeout and version are supported than as part of the individual search items in msearch? are these params listed in your last comment the ones that seem supported or not supported by msearch? |
@javanna I've taken a stab at it and came up with this draft commit zacharymorn@3a24265 Basically I was trying to move the shared rest request params parsing logic below from elasticsearch/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java Lines 180 to 269 in 8195d68
|
I did some basic testings for the draft commit, looks like the With
|
the idea looks good to me @zacharymorn . Can you open a PR so we can discuss the changes? |
I opened the PR above. I do have a few more questions though, primarily around whether certain query params are also applicable to |
I looked into the unsupported params for elasticsearch/server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java Lines 215 to 248 in b4bc6ac
There are also three params that have different field names when used in query body Query Param Names
Query Body Field Names
|
Essentially there are 3 locations that params can be specified for
The header & body specifically refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html Specifically, here are the params supported in each of these 3 locations URL query params
Header section for each search request in payload
Body section for each search request in payloadAs both Hence, I guess for On the other hand, so far I was only able to find the followings that are supported for Seen in RestActions.urlParamsToQueryBuilder, used by RestSearchAction.parseSearchSource
Seen in RestSearchAction.parseSearchSource
In addition, |
@javanna Any update on this ? |
We are migrating from TransportClient to RestHighLevelClient and I stumbled across this issue because TransportClient supports at least some parameters which RestHighLevelClient (or REST API in general) does not. In our case this is This is realy unpredictibal, because you get no error just other results when dooing the same request with RestHighLevelClient instead TransportClient. So please fix this issue or at least throw an exception when trying to do a request with RestHighLevelClient with unsupported parameters. |
heya @xtermi2 I don't follow what you mean. I am wondering if you mean that something different between high level client and transport client, or between msearch and search, and where the |
@zacharymorn sorry I was out for a long while and I missed your ping, I will try to get back to this soon. |
@javanna Yes, there is a difference in transport client and rest client (or in general in REST API). Just have a look at https://github.com/xtermi2/elasticsearch-resthighlevelclient-msearch-scrollId/blob/master/src/test/java/com/github/xtermi2/elasticsearch/RHLCMsearchScrollIdTest.java
It's the same request (MultiSearchRequest) for both clients. So from the perspective of the transport-client/RestHighLevelClient I have the exact same API but get different behavior which is totally unexpected. As I said, the minimum should be to provide a Exception when you want to do a _msearch request which provides unsupported parameters via RestHighLevelClient - until this issue is fixed and _msearch supports all parameters from _search |
ok @xtermi2 thanks for clarifying, could you please open a new issue and post the exact error you are getting as well as how to reproduce it? Thanks! |
Hello, What's the current state of this issue? Thanks in advance. |
The part I mention in #4227 (comment) is still not fixed! The referenced github project is still failing with the latest elasticsearch version. There is a integrationtest comparing transport client with rest client/API |
Hi, @xtermi2 . @zacharymorn PR #48673 Is there any plans to that PR @javanna ? How should this ticket be handled? Is it preferred I open a PR solving only @xtermi2 concern? |
can i work on this issue , plz guide me its my first contribution |
Pinging @elastic/es-search (Team:Search) |
Created a draft PR here - it would be great to have feedback on the overall approach |
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
The
_msearch
API doesn't accept the same header parameters than_search
's query parameters.For instance
version
is both valid in the search body and query parameters for_search
, but is ignored in the query parameters and header in_msearch
.MultiSearchRequest.add()
should rely onRestSearchAction.parseSearchSource()
or evenRestSearchAction.parseSearchRequest()
to parse the subrequests, for maximum compatibility.IMHO, a clean bulk API should use the header parameters as query parameters on the target endpoint, which would imply that they keep in sync no matter the code changes in the target endpoints.
The text was updated successfully, but these errors were encountered: