-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add support for providing absolute start time to SearchRequest #37142
Add support for providing absolute start time to SearchRequest #37142
Conversation
We have recently added support for providing a local cluster alias to a SearchRequest through a package protected constructor. When executing cross-cluster search requests with local reduction on each cluster, the CCS coordinating node will have to provide such cluster alias to each remote cluster, as well as the absolute start time of the search action in milliseconds from the time epoch, to be used when evaluating date math expressions both while executing queries / scripts as well as when resolving index names. This commit adds support for providing the start time together with the cluster alias. It is a final member in the search request, which will only be set when using cross-cluster search with local reduction (also known as alternate execution mode). When not provided, the coordinating node will determine the current time and pass it through (by calling `System.currentTimeMillis`). Relates to elastic#32125
Pinging @elastic/es-search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a minor comment but the change looks good to me.
*/ | ||
@Nullable | ||
Long getAbsoluteStartMillis() { | ||
return absoluteStartMillis == DEFAULT_ABSOLUTE_START_MILLIS ? null : absoluteStartMillis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is called only once it could be called getOrCreateAbsoluteStartMillis() and return System.currentTimeMillis()
if the absoluteStartMillis
is not set (equals to `-1) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I will do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could even use currentTimeMillis as a default in the constructor considering when the search request gets created on the coord node, if it wasn't for the transport client, in which case that would take the current time on the client instead of on the server.. Too bad :)
In Lucene 8 searches can skip non-competitive hits if the total hit count is not requested. It is also possible to track the number of hits up to a certain threshold. This is a trade off to speed up searches while still being able to know a lower bound of the total hit count. This change adds the ability to set this threshold directly in the track_total_hits search option. A boolean value (true, false) indicates whether the total hit count should be tracked in the response. When set as an integer this option allows to compute a lower bound of the total hits while preserving the ability to skip non-competitive hits when enough matches have been collected. Relates #33028
We have recently added support for providing a local cluster alias to a SearchRequest through a package protected constructor. When executing cross-cluster search requests with local reduction on each cluster, the CCS coordinating node will have to provide such cluster alias to each remote cluster, as well as the absolute start time of the search action in milliseconds from the time epoch, to be used when evaluating date math expressions both while executing queries / scripts as well as when resolving index names. This commit adds support for providing the start time together with the cluster alias. It is a final member in the search request, which will only be set when using cross-cluster search with local reduction (also known as alternate execution mode). When not provided, the coordinating node will determine the current time and pass it through (by calling `System.currentTimeMillis`). Relates to #32125
We have recently added support for providing a local cluster alias to a
SearchRequest through a package protected constructor. When executing
cross-cluster search requests with local reduction on each cluster, the
CCS coordinating node will have to provide such cluster alias to each
remote cluster, as well as the absolute start time of the search action
in milliseconds from the time epoch, to be used when evaluating date
math expressions both while executing queries / scripts as well as when
resolving index names.
This commit adds support for providing the start time together with the
cluster alias. It is a final member in the search request, which will
only be set when using cross-cluster search with local reduction (also
known as alternate execution mode). When not provided, the coordinating
node will determine the current time and pass it through (by calling
System.currentTimeMillis
).Relates to #32125