-
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
semantic_text: Add index metadata information for inference field mappers #107147
semantic_text: Add index metadata information for inference field mappers #107147
Conversation
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.
Few minor comments, LGTM otherwise. Let's remove the draft status and have another reviewer since the targeted branch is main?
server/src/main/java/org/elasticsearch/index/mapper/InferenceFieldMapper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java
Outdated
Show resolved
Hide resolved
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.
A minor concern. I think it all looks OK. My other concerns were about null
being accidentally provided in the ctor as we have a ton of stuff that relies on the inference fields not being null
, but instead empty
, but it seems like we have adequate coverage and protection there. Just being paranoid :)
String inferenceId = randomIdentifier(); | ||
String[] inputFields = generateRandomStringArray(5, 10, false, false); | ||
return new InferenceFieldMetadata(name, inferenceId, inputFields); | ||
} |
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.
Could we have some tests covering the null
cases that throw?
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.
Sure! dc46e88
@elasticsearchmachine update branch |
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, only two small qeustions/comments
server/src/main/java/org/elasticsearch/cluster/metadata/InferenceFieldMetadata.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataTests.java
Outdated
Show resolved
Hide resolved
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 couldn't come up with anything else either as discussed on Slack :) Thanks Carlos!
…metadata-changes # Conflicts: # server/src/main/java/org/elasticsearch/TransportVersions.java
As prior work for
semantic_text
new field type, these changes add newIndexMetadata
information for field types that need inference to be performed.As inference is done in the coordinator node to avoid re-doing it at shard / replica level, the coordinator needs to check for the need to perform inference for specific fields in an index.
Given that the coordinator node does not necessarily have mapping information for all indices (only for those that have shards in the node), the field inference information must be stored in the
IndexMetadata
and broadcasted to all nodes.This change adds:
InferenceFieldMetadata
class that contains the information for fields that need inferenceInferenceFieldMapper
interface that will be implemented bysemantic_text
and any other field types that require inference, so this information can be retrieved from the field mappingIndexMetadata