Skip to content

Conversation

weizijun
Copy link
Contributor

@weizijun weizijun commented Jan 8, 2025

where upgrade from 8.13 to 8.17 or newer version, the java client will failed when use rrf and window_size parameter.

I added the window_size parameter back to the deprecated parameters to support upgrades.

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.0.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Jan 8, 2025
@mayya-sharipova mayya-sharipova added :Search Relevance/Ranking Scoring, rescoring, rank evaluation. and removed needs:triage Requires assignment of a team area label labels Jan 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Jan 10, 2025
@pmpailis pmpailis self-assigned this Jan 13, 2025
@pmpailis
Copy link
Contributor

Thank you for taking a look at this and raising a PR @weizijun ! Before proceeding, could you please elaborate a bit on the use case here and what we want to solve?
Is it fair to assume that you're using the latest java client and want to interact with older indices during the upgrade process (or in a mixed cluster scenario)?

@weizijun
Copy link
Contributor Author

weizijun commented Jan 15, 2025

Thank you for taking a look at this and raising a PR @weizijun ! Before proceeding, could you please elaborate a bit on the use case here and what we want to solve? Is it fair to assume that you're using the latest java client and want to interact with older indices during the upgrade process (or in a mixed cluster scenario)?

Thanks to @pmpailis for the comment. Before the upgrade, the user was using version 8.13 of the client. He used the window_size in the rrf dsl. Then he upgrade elasticsearch version from 8.13 to 8.15, and his search requests would failed.
Here is the error stack. This is from the python client.

Traceback (most recent call last):  File "/usr/local/lib/python3.8/site-packages/ms_docsqa/handlers/docs_retrieval_hander.py", line 194, in post    doc_chunks_list: List[SearchDocResponse] = await async_es_client.msearch_documents(doc_request_list)  File "/usr/local/lib/python3.8/site-packages/ms_docsqa/service/es_client.py", line 350, in msearch_documents    results: ObjectApiResponse[Any] = await self.es.msearch(body=search_ops)  File "/usr/local/lib/python3.8/site-packages/elasticsearch/_async/client/__init__.py", line 2699, in msearch    return await self.perform_request(  # type: ignore[return-value]  File "/usr/local/lib/python3.8/site-packages/elasticsearch/_async/client/_base.py", line 320, in perform_request    raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(elasticsearch.BadRequestError: BadRequestError(400, 'x_content_parse_exception', '[1:22079] [rrf] unknown field [rank_window_size] did you mean [window_size]?')

@pmpailis
Copy link
Contributor

Thanks for the details @weizijun !

Given that we're discussing rrf for 8.13, I'd assume that this is using the rank API, correct? The parameter name was changed in 8.15 (link) along with the respective client specifications.

Looking at the error message, it seems that the client/requests are using the updated (and correct) rank_window_size parameter, but the API cannot identify this (and suggests the window_size param instead) which would only be true for < 8.15 releases (8.13 in this case).

So, IIUC, the error is caused when using an 8.15 client with a 8.13 (as in the example) deployment, which is somewhat expected given the API changes (for a tech preview feature at the time).

Another thing to note, is that the rank API has been deprecated in 8.16 and will be removed in later releases. The alternative is to make use of the (now GA) retrievers framework instead (https://www.elastic.co/guide/en/elasticsearch/reference/current/retriever.html#rrf-retriever)

@weizijun
Copy link
Contributor Author

Looking at the error message, it seems that the client/requests are using the updated (and correct) rank_window_size parameter, but the API cannot identify this (and suggests the window_size param instead) which would only be true for < 8.15 releases (8.13 in this case).

So, IIUC, the error is caused when using an 8.15 client with a 8.13 (as in the example) deployment, which is somewhat expected given the API changes (for a tech preview feature at the time).

Yes, when a user upgrades from 8.13 to 8.15, in the middle of the process, the cluster has two version nodes, no matter he uses rank_window_size or window_size, it will fail. This results in breaking changes and makes it impossible to upgrade versions.

@pmpailis
Copy link
Contributor

pmpailis commented Jan 21, 2025

The rank-rrf feature was in tech-preview for 8.13 as was mentioned in the docs, which also notes that

This functionality is in technical preview and may be changed or removed in a future release. The syntax will likely change before GA.

The API did change in 8.15, however please also note that the rank feature has been deprecated in 8.16.0.

Furthermore, along with the GA release of retrievers, a breaking change has also been published, so an rrf retriever won't be compatible in a mixed cluster with with < 8.16 and >= 8.16 versions because of some fundamental incompatibilities between the tech preview and GA versions.

Would it be an option to such incompatible pause queries during the upgrade, and then migrate to the fully supported retriever version of the rrf request once on 8.17?

@weizijun
Copy link
Contributor Author

Would it be an option to such incompatible pause queries during the upgrade, and then migrate to the fully supported retriever version of the rrf request once on 8.17?

Yeah, I know it has replacement usage, I added the deprecated parameter just to support users who use that feature. It is easy to support.

@pmpailis
Copy link
Contributor

@weizijun we can target the 8.x branch and backport all the way to 8.16 (which will still get another release) just for rank. So in essence, the >=8.16 versions would be able to handle both window_size and rank_window_size.

Could you please update the PR (or setup a new one) to target 8.x branch instead?

Merging this in main (i.e. 9.x) won't provide much value at this point.

@weizijun
Copy link
Contributor Author

Could you please update the PR (or setup a new one) to target 8.x branch instead?

ok, I will open a new PR.

@weizijun
Copy link
Contributor Author

fixed at 8.x branch

@weizijun weizijun closed this Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team :Search Relevance/Ranking Scoring, rescoring, rank evaluation. Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants