Skip to content

Conversation

kderusso
Copy link
Member

Resolves #131443

Resolves a bug where semantic_text fields configuring index_options to flat quantization types were not returning results from the semantic highlighter.

Example to reproduce issue:

DELETE test-index 

PUT test-index
{
  "mappings": {
    "properties": {
      "body_content_e5": {
        "type": "semantic_text",
        "inference_id": ".multilingual-e5-small-elasticsearch",
        "index_options": {
          "dense_vector": {
            "type": "int4_hnsw",
            "confidence_interval": 0
          }
        }
      }
    }
  }
}

PUT test-index/_doc/1
{
  "body_content_e5": "Elasticsearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides."
}

get test-index/_search
{
  "highlight": {
    "fields": {
      "body_content_e5": {
        "number_of_fragments": 1,
        "order": "score",
        "type": "semantic"
      }
    }
  },
  "fields": [
    "_inference_fields"
  ],
  "retriever": {
    "standard": {
      "query": {
        "semantic": {
          "field": "body_content_e5",
          "query": "What is Elasticsearch?"
        }
      }
    }
  }
}

@kderusso kderusso added >bug :Search Relevance/Highlighting How a query matched a document auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 v9.2.0 labels Jul 18, 2025
@kderusso kderusso requested a review from a team July 18, 2025 13:51
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Jul 18, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

LGTM, nice clean fix and tests!

@Mikep86
Copy link
Contributor

Mikep86 commented Jul 18, 2025

Can we also backport to 8.18 & 9.0?

@kderusso
Copy link
Member Author

Can we also backport to 8.18 & 9.0?

@Mikep86 there's no point to backporting to 8.18/9.0, because it's impossible to create a flat quantized semantic_text index until 8.19/9.1.

@kderusso kderusso enabled auto-merge (squash) July 18, 2025 14:49
@kderusso kderusso merged commit 90699d3 into elastic:main Jul 18, 2025
33 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
9.1 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 131525

kderusso added a commit to kderusso/elasticsearch that referenced this pull request Jul 18, 2025
* Fix semantic highlighting bug on flat quantized fields

* Update docs/changelog/131525.yaml

(cherry picked from commit 90699d3)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java
@kderusso
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.1
8.19

Questions ?

Please refer to the Backport tool documentation

kderusso added a commit to kderusso/elasticsearch that referenced this pull request Jul 18, 2025
* Fix semantic highlighting bug on flat quantized fields

* Update docs/changelog/131525.yaml

(cherry picked from commit 90699d3)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java
kderusso added a commit that referenced this pull request Jul 18, 2025
…1549)

* Fix semantic highlighting bug on flat quantized fields

* Update docs/changelog/131525.yaml

(cherry picked from commit 90699d3)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java
kderusso added a commit that referenced this pull request Jul 18, 2025
…1550)

* Fix semantic highlighting bug on flat quantized fields

* Update docs/changelog/131525.yaml

(cherry picked from commit 90699d3)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending >bug :Search Relevance/Highlighting How a query matched a document Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.19.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Semantic text highlighting not returned for flat quantization options

4 participants