Avoid deprecated from and to parameters for ES range queries #3635
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
fromandtoparameters for range queries were deprecated in Elasticsearch 0.90.4, and more than ten years later, they were finally removed in Elasticsearch 9.x. Therefore, the existing code did not work any longer when using modern versions of Elasticsearch.This is fixed now by using the
gteandlteparameters instead offromandto. In addition to that, the code is simplified a bit by directly using the values as-is and telling Elasticsearch about the format instead of converting them in the client code. This is the approach that was already taken byapp/eslog/src/main/java/org/phoebus/applications/eslog/archivedjmslog/ElasticsearchModel.java.Fixes #3632.
Checklist
I tested that with the change, the alarm logger service works correctly with Elasticsearch 9.x: The range query is accepted again and the log view in Phoebus shows the expected results.
As we haven’t deployed the save & restore service yet, I wasn’t able to test the changes there, but as they are essentially the same, I find it very likely that they will have the intended effect.