elasticsearch-py icon indicating copy to clipboard operation
elasticsearch-py copied to clipboard

Add support for include_named_queries_score param in _search endpoint

Open styrmis opened this issue 1 year ago • 0 comments

Elasticsearch version (bin/elasticsearch --version): 8.8.2

elasticsearch-py version (elasticsearch.__versionstr__): 8.12.0

Description of the problem including expected versus actual behavior:

The include_named_queries_score is present in the REST API spec but it does not appear to have been picked up in the generation process for this library.

There is a generated example which uses the param, but this fails for me as the param is not defined, which matches the docs for the search method.

To work around this we are currently experimenting with making a lower-level request, e.g.

resp = es.transport.perform_request(
    'GET',
    f'/{index}/_search?include_named_queries_score=true',
    headers={'Content-type': 'application/json'},
    body=body
)

The expected behaviour is that it be possible to specify the include_named_queries_score parameter (as per the example) and that the response would have the matched_queries key set, with calculated scores, if the submitted query body contains named queries.

Steps to reproduce:

Run the generated example which sets include_named_queries_score.

styrmis avatar Feb 15 '24 13:02 styrmis