Skip to content
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

track_total_hits should be Union of boolean and integer #43954

Closed
russcam opened this issue Jul 4, 2019 · 3 comments
Closed

track_total_hits should be Union of boolean and integer #43954

russcam opened this issue Jul 4, 2019 · 3 comments
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@russcam
Copy link
Contributor

russcam commented Jul 4, 2019

Issue

The search.json REST API spec in 7.x defines track_total_hits as a boolean

"track_total_hits": {
"type" : "boolean",
"description": "Indicate if the number of documents that match the query should be tracked"
},

The documentation indicates however that track_total_hits can be a boolean or an integer i.e. a discriminated union of two different types.

Since Elasticsearch clients generate code from the REST API specs, track_total_hits will be modelled as a boolean only. For example

in elasticsearch-js

https://github.com/elastic/elasticsearch-js/blob/21863965706e0ebfcbe34e0436bf3359579dc834/api/requestParams.d.ts#L1123

in elasticsearch-net

https://github.com/elastic/elasticsearch-net/blob/69cf48c400bfc774ed16aeb502abd13565d72f3c/src/Nest/Requests.NoNamespace.cs#L2812-L2817

Request

track_total_hits should be modelled as a union of boolean and int. For example,

 "track_total_hits": { 
   "type" : "boolean|integer", 
   "description": "Indicate if the number of documents that match the query should be tracked (true or false), or an integer to accurately track the total hit count that match the query up to" 
 },

I propose making this change for 8.x. It would not be feasible to make this change in 7.x because it would break (binary) compatibility of already released, generated client code.

@gwbrown gwbrown added the :Search/Search Search-related issues that do not fall into other categories label Jul 4, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@karmi
Copy link
Contributor

karmi commented Jul 4, 2019

I can't find the previous conversation we had about this topic, but what about making the type an array? (Also related the schema change in #42346)

@rjernst rjernst added the Team:Search Meta label for search team label May 4, 2020
@russcam
Copy link
Contributor Author

russcam commented Jul 17, 2020

This was addressed in #51846. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

No branches or pull requests

5 participants