-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Term vector API on stateless search nodes #129902
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
Merged
kingherc
merged 23 commits into
elastic:main
from
kingherc:non-issue/ES-12112-termvectors
Jul 22, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e3b6a4b
Term vector API on stateless search nodes
kingherc 551564a
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc f6a2b60
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc ac6501e
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 768061c
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 4700319
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 7b78d40
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 10a0516
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc a1de023
Move transport action to serverless
kingherc 0d35fe4
PR comments
kingherc e56b4b2
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc cc02815
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc e022eb1
Remove dead code
kingherc ecd0132
Checkstyle
kingherc f3b5777
Make action internal
kingherc 9bf99d9
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc d4e7c8b
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 2533240
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 032ea2e
Allow refreshing a shard by system
kingherc 849e31c
Add wait_for_no_initializing_shards in yaml rest
kingherc fde5fe0
Add special origin to call refresh shard
kingherc 12b0d36
Merge remote-tracking branch 'kingherc/main' into non-issue/ES-12112-…
kingherc 167fa81
Comments
kingherc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
server/src/main/java/org/elasticsearch/action/termvectors/EnsureDocsSearchableAction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| * | ||
| * This file was contributed to by generative AI | ||
| */ | ||
|
|
||
| package org.elasticsearch.action.termvectors; | ||
|
|
||
| import org.elasticsearch.action.ActionRequestValidationException; | ||
| import org.elasticsearch.action.ActionResponse; | ||
| import org.elasticsearch.action.ActionType; | ||
| import org.elasticsearch.action.support.single.shard.SingleShardRequest; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * This action is used in serverless to ensure that documents are searchable on the search tier before processing | ||
| * term vector requests. It is an intermediate action that is executed on the indexing node and responds | ||
| * with a no-op (the search node can proceed to process the term vector request). The action may trigger an external refresh | ||
| * to ensure the search shards are up to date before returning the no-op. | ||
| */ | ||
| public class EnsureDocsSearchableAction { | ||
|
|
||
| private static final String ACTION_NAME = "internal:index/data/read/eds"; | ||
| public static final ActionType<ActionResponse.Empty> TYPE = new ActionType<>(ACTION_NAME); | ||
| public static final String ENSURE_DOCS_SEARCHABLE_ORIGIN = "ensure_docs_searchable"; | ||
|
|
||
| public static final class EnsureDocsSearchableRequest extends SingleShardRequest<EnsureDocsSearchableRequest> { | ||
|
|
||
| private int shardId; // this is not serialized over the wire, and will be 0 on the other end of the wire. | ||
| private String[] docIds; | ||
|
|
||
| public EnsureDocsSearchableRequest() {} | ||
|
|
||
| public EnsureDocsSearchableRequest(StreamInput in) throws IOException { | ||
| super(in); | ||
| docIds = in.readStringArray(); | ||
| } | ||
|
|
||
| @Override | ||
| public ActionRequestValidationException validate() { | ||
| return super.validateNonNullIndex(); | ||
| } | ||
|
|
||
| public EnsureDocsSearchableRequest(String index, int shardId, String[] docIds) { | ||
| super(index); | ||
| this.shardId = shardId; | ||
| this.docIds = docIds; | ||
| } | ||
|
|
||
| public int shardId() { | ||
| return this.shardId; | ||
| } | ||
|
|
||
| public String[] docIds() { | ||
| return docIds; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| super.writeTo(out); | ||
| out.writeStringArray(docIds); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
is this removed intentionally?
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 because it won't work in Serverless, as there'll be no search shard to execute the new term API. In serverless we force to have a search node and we'd like a search shard.
So this way it works in both stateful and stateless.
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 wonder if the test would become flaky now that we don't wait for the cluster to go green, that's why I was asking.
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.
To wait for the search shard is definitely up and running, I incorporated the following piece of code
which is copied from #114641 which solved a similar issue to make the tests work in both ES and serverless.
I run it also 10 locally, both core ES and severless, and it succeeds. Feel free to tell me if you have more feedback.