Skip to content

Search coordinator uses event.ingested in cluster state to do rewrites#110352

Merged
quux00 merged 13 commits intoelastic:mainfrom
quux00:search-coordinator/uses-event.ingested-in-cluster-state
Jul 11, 2024
Merged

Search coordinator uses event.ingested in cluster state to do rewrites#110352
quux00 merged 13 commits intoelastic:mainfrom
quux00:search-coordinator/uses-event.ingested-in-cluster-state

Conversation

@quux00
Copy link
Copy Markdown
Contributor

@quux00 quux00 commented Jul 1, 2024

Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in #106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.

@quux00 quux00 added >enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.15.0 labels Jul 1, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @quux00, I've created a changelog YAML for you.

@quux00 quux00 requested review from javanna and martijnvg July 1, 2024 19:17
Copy link
Copy Markdown
Contributor

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of comments on internal API design etc.

Comment thread server/src/main/java/org/elasticsearch/indices/IndicesService.java Outdated
quux00 added 6 commits July 8, 2024 11:45
It now looks up time range from timeseries if the @timestamp range from cluster
state is not useful (UKNOWN) or not ready (not all shards accounted for).
It no longer also depends on eventIngested being in a non-ready/non-usable state.
…xt and replaced Map<String, DataFieldType> with it
Copy link
Copy Markdown
Contributor

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, almost there, a couple more questions.

Comment thread server/src/main/java/org/elasticsearch/indices/CachedTimestampFieldInfo.java Outdated
Comment thread server/src/main/java/org/elasticsearch/indices/CachedTimestampFieldInfo.java Outdated
Copy link
Copy Markdown
Contributor

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (left a small question, no need for another review round)

* @return min timestamp for the field from IndexMetadata in cluster state.
*/
long getMinTimestamp(String fieldName) {
if (fieldName.equals(DataStream.TIMESTAMP_FIELD_NAME)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super minor nitpick: fieldName can never be null right? I see that getMaxTimestamp does the equal the other way around, that's not going to throw NPE, while this one is different. Perhaps it does not matter, but I wondered why.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch. I'll make them consistent.

@quux00
Copy link
Copy Markdown
Contributor Author

quux00 commented Jul 10, 2024

buildkite test this

@quux00 quux00 merged commit d45d164 into elastic:main Jul 11, 2024
quux00 added a commit to quux00/elasticsearch that referenced this pull request Jul 11, 2024
elastic#110352)

Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in elastic#106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.
quux00 added a commit that referenced this pull request Jul 11, 2024
#110352) (#110782)

Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in #106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.
Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM2 (I thought I clicked submit review)

/**
* Data holder of timestamp fields held in cluster state IndexMetadata.
*/
public final class DateFieldRangeInfo {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be a record?

quux00 added a commit to quux00/elasticsearch that referenced this pull request Jul 15, 2024
quux00 added a commit to quux00/elasticsearch that referenced this pull request Jul 15, 2024
quux00 added a commit that referenced this pull request Jul 15, 2024
quux00 added a commit that referenced this pull request Jul 15, 2024
tvernum pushed a commit that referenced this pull request Feb 25, 2025
#110352)

Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in #106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.
tvernum pushed a commit that referenced this pull request Feb 25, 2025
tvernum pushed a commit that referenced this pull request Feb 25, 2025
#110352)

Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in #106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.
tvernum pushed a commit that referenced this pull request Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants