Fix NPE in SemanticTextHighlighter#129509
Merged
jimczi merged 6 commits intoelastic:mainfrom Jun 17, 2025
Merged
Conversation
If the model settings is null then the field is guaranteed to not have any indexed content. Closes elastic#129501
Collaborator
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
Collaborator
|
Hi @jimczi, I've created a changelog YAML for you. |
…settings' into semantic_highlighter_null_model_settings
Mikep86
approved these changes
Jun 17, 2025
Contributor
Mikep86
left a comment
There was a problem hiding this comment.
Looks good, thanks for the quick fix! I left one comment about cluster features.
...nce/src/yamlRestTest/resources/rest-api-spec/test/inference/90_semantic_text_highlighter.yml
Show resolved
Hide resolved
kderusso
approved these changes
Jun 17, 2025
Member
kderusso
left a comment
There was a problem hiding this comment.
LGTM thanks for the quick fix
...nce/src/yamlRestTest/resources/rest-api-spec/test/inference/90_semantic_text_highlighter.yml
Show resolved
Hide resolved
Contributor
Samiul-TheSoccerFan
left a comment
There was a problem hiding this comment.
Looks good, Is the error happening silently? I tried with both sparse and dense vector in both ES3 and 8.17.2 but could not reproduce the error. I tried something like this:
PUT _inference/text_embedding/mistral-text_embedding
{
"service": "mistral",
"service_settings": {
"model": "mistral-embed",
"dimensions": 1024,
"similarity": "dot_product",
"rate_limit": {
"requests_per_minute": 240
},
"api_key": "API_KEY"
},
"chunking_settings": {
"strategy": "sentence",
"max_chunk_size": 250,
"sentence_overlap": 1
}
}
PUT my-index
{
"mappings": {
"properties": {
"keyword_field": {
"type": "keyword"
},
"inference_field": {
"type": "semantic_text",
"inference_id": "mistral-text_embedding"
}
}
}
}
POST my-index/_search
{
"query": {
"semantic": {
"field": "inference_field",
"query": "What is Elasticsearch?"
}
},
"fields": ["_inference_fields"],
"highlight": {
"fields": {
"inference_field": {} -- tried with `type=semantic` as well
}
}
}
...nce/src/yamlRestTest/resources/rest-api-spec/test/inference/90_semantic_text_highlighter.yml
Show resolved
Hide resolved
Member
Good question. I think it's OK if the bug hasn't been ported to Serverless? |
Contributor
Author
|
@Samiul-TheSoccerFan your reproduction query doesn't return any document. Try with this: |
Collaborator
💚 Backport successful
|
jimczi
added a commit
to jimczi/elasticsearch
that referenced
this pull request
Jun 17, 2025
If the model settings is null then the field is guaranteed to not have any indexed content. Closes elastic#129501
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jun 17, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If the model settings is null then the field is guaranteed to not have any indexed content.
Closes #129501