Skip to content

MaxScore not filled on SearchResponse at the root level but only in the HitsMetadata #7886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #8356
TheFireCookie opened this issue Aug 9, 2023 · 3 comments
Labels
8.x Relates to a 8.x client version Area: Specification Usability

Comments

@TheFireCookie
Copy link
Contributor

TheFireCookie commented Aug 9, 2023

Elastic.Clients.Elasticsearch version:
8.9.1

Elasticsearch version:
8.9.0

.NET runtime version:
7.0.10

Operating system version:
Windows 11

Description of the problem including expected versus actual behavior:
Do a search with .TrackScore() enabled and then look at the value of the MaxScore property of the SearchResponse, it's always at null even if there is a value in the JSON.

Steps to reproduce:

  1. Do a search with .TrackScore() enabled
  2. Check the JSON answered, the max_score property is there
  3. Check the SearchResponse class, no MaxScore property is set at the root level even if the property is available only at the HitsMetadata level.

Expected behavior
MaxScore is set correctly at both level or root level is deleted.

Json sent:

{
    "track_scores": true
}

Json received:

{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 5,
            "relation": "eq"
        },
        "max_score": 1.0,
....
}

.NET code
image

@TheFireCookie TheFireCookie added the 8.x Relates to a 8.x client version label Aug 9, 2023
@TheFireCookie TheFireCookie changed the title MaxScore not filled on SearchResponse MaxScore not filled on SearchResponse at the root level but only in the HitsMetadata Aug 9, 2023
@flobernd
Copy link
Member

The client just deserializes what the server sends and in this case, the server does not send the max_score field on top level at all. I have to check if the top level max_score field should even exists. It is defined in the current specification, but that might as well be a bug. Will come back to you after clarifying.

@TheFireCookie
Copy link
Contributor Author

I think the good fix is just to remove that property at the root, it's a little bit like the settings issue that I found with the slow settings:
#7865

@flobernd
Copy link
Member

Same seems to apply to ScrollResponse, SearchTemplateResponse and others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version Area: Specification Usability
Projects
None yet
Development

No branches or pull requests

2 participants