-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Closed
Labels
:SearchOrg/RelevanceLabel for the Search (solution/org) Relevance teamLabel for the Search (solution/org) Relevance team>bugTeam:Search - RelevanceThe Search organization Search Relevance teamThe Search organization Search Relevance teamTeam:SearchOrgMeta label for the Search Org (Enterprise Search)Meta label for the Search Org (Enterprise Search)
Description
Elasticsearch Version
9.1
Installed Plugins
No response
Java Version
bundled
OS Version
N/A
Problem Description
match, knn, and sparse_vector queries that target semantic_text fields drop any boosts applied to those queries when they are rewritten.
This happens because the query interception logic makes incomplete copies of the queries during rewrite. Other information is lost in this copy operation as well, such as any name assigned to the query.
Steps to Reproduce
- Create an index with a
semantic_textfield
PUT my-index
{
"mappings": {
"properties": {
"title": {
"type": "text"
},
"author": {
"type": "text"
},
"summary": {
"type": "text",
"copy_to": "semantic_summary"
},
"semantic_summary": {
"type": "semantic_text"
},
"moral_lesson": {
"type": "text",
"copy_to": "semantic_moral"
},
"semantic_moral": {
"type": "semantic_text"
}
}
}
}- Add docs to the index
POST my-index/_doc/1
{
"title": "Cinderella",
"author": "Charles Perrault",
"summary": "Cinderella is a young girl mistreated by her stepmother and stepsisters until she meets a fairy godmother.",
"moral_lesson": "Goodness and kindness will always be rewarded."
}
POST my-index/_doc/2
{
"title": "Little Red Riding Hood",
"author": "Brothers Grimm",
"summary": "A young girl encounters a cunning wolf on her way to visit her grandmother.",
"moral_lesson": "Beware of strangers."
}- Query a
semantic_textfield using amatchquery with a boost
GET my-index/_search
{
"query": {
"match": {
"semantic_moral": {
"query": "danger",
"boost": 2.0
}
}
}
}Logs (if relevant)
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
:SearchOrg/RelevanceLabel for the Search (solution/org) Relevance teamLabel for the Search (solution/org) Relevance team>bugTeam:Search - RelevanceThe Search organization Search Relevance teamThe Search organization Search Relevance teamTeam:SearchOrgMeta label for the Search Org (Enterprise Search)Meta label for the Search Org (Enterprise Search)