Skip to content

[DOC] Wrong field specified in query of hybrid search with search_after page #9543

Closed
@yizheliu-amazon

Description

@yizheliu-amazon

What do you want to do?

  • Request a change to existing documentation
  • Add new documentation
  • Report a technical problem with the documentation
  • Other

Tell us about your request. Provide a summary of the request.

In the page for hybrid search with search_after, the query is expected to be sorting at doc_price. However, in current page, it is sorting at _id.

Existing query

{
  "query": {
    "hybrid": {
      "queries": [
        {
          "term": {
            "category": "permission"
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "category": "editor"
                }
              },
              {
                "term": {
                  "category": "statement"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "sort":[
     {
        "_id": {
          "order": "desc"   
        }
     } 
  ],
  "search_after":[200]
}

Correct query:

{
  "query": {
    "hybrid": {
      "queries": [
        {
          "term": {
            "category": "permission"
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "category": "editor"
                }
              },
              {
                "term": {
                  "category": "statement"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "sort":[
     {
        "doc_price": {
          "order": "desc"   
        }
     } 
  ],
  "search_after":[200]
}

Version:

This is introduced since 2.16

What other resources are available? Provide links to related issues, POCs, steps for testing, etc.
N/A

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions