-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[feature/semantic-text] Simplify the integration of the field inference metadata in IndexMetadata
#106743
[feature/semantic-text] Simplify the integration of the field inference metadata in IndexMetadata
#106743
Conversation
…erver (elastic#105012)" This reverts commit f4d3ab9.
…copy-to-support-inference # Conflicts: # server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequestInferenceProvider.java # server/src/test/java/org/elasticsearch/action/bulk/BulkOperationTests.java
…-fields in the mapping
…instead of re-creating them each time.
…gister_semantic_text
…ference_metadata_diff
Pinging @elastic/es-search (Team: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.
LGTM - I believe this is a simpler solution.
server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/InferenceFieldMetadata.java
Show resolved
Hide resolved
if (item.request() instanceof IndexRequest ir) { | ||
indexRequest = ir; | ||
} else if (item.request() instanceof UpdateRequest updateRequest) { | ||
if (updateRequest.script() != null) { |
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.
Good catch, the update could be a script and not a doc. Thanks for fixing this
} | ||
indexRequest = updateRequest.doc(); | ||
} else { | ||
// ignore delete request |
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.
Good catch (x2)
@@ -119,6 +130,11 @@ public NestedObjectMapper getSubMappers() { | |||
return subMappers; | |||
} | |||
|
|||
@Override | |||
public InferenceFieldMetadata getMetadata(Set<String> sourcePaths) { |
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.
Nice - we use the same structure for retrieving metadata directly from the field type
index: test-sparse-index | ||
body: | ||
- '{"update": {"_id": "doc_1"}}' | ||
- '{"doc":{"inference_field": "I am a test", "another_inference_field": "I am a teapot"}}' |
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 am a teapot"
HTTP 418 FTW 🤣
…ference_metadata_diff
…ference_metadata_diff
This change refactors the integration of the field inference metadata in
IndexMetadata
. Instead of partial diffs, the new class simply sends the entire object as diff if it has changed.This PR also rename the fields and methods related to the inference fields consistently.
The inference phase (in the transport shard bulk action) is also changed so that inference is not called if:
If the document contains no value for the inference input but an inference result for that field, it is marked as failed.