Closed Jakob3xD closed 2 months ago
Moving this to OpenSearch repo.
CAT stands for "Compact and aligned text (CAT) APIs" (note the text part) and Elasticsearch designed it with "cat APIs are only intended for human consumption" in mind. I think this is why these APIs return text.
Of course, in 2024, this doesn't make sense. Strongly typed JSON responses are equally humanly readable when they aren't strings.
[Triage - attendees 1 2] @Jakob3xD Thanks for creating this issue, it looks like this feature request is a good one and it could break existing applications that expect only string fields. Maybe there should be more discussion about what is done here.
If there is a specific piece of information that you'd like a structured way to access maybe there is another API that does expose that information, maybe create another issue if that use case isn't covered with our existing APIs.
My initial intention was related to the golang opensearch lib, where I currently parse the fields that are numbers inside string as actual numbers. Knowing what cat actually stands for made my request probably obsolete. As the lib uses should not use the cat API, to for example get index information, but rather use the /_stats
endpoint.
IMO the strings can be kept as string as they also transform with the time
and bytes
parameter.
Therefore I am good with closing the issue.
Is your feature request related to a problem?
cat requests return every field as string even though the actual value is a different one. It would be nice to have the actual type of value and not only the string value. Uses would not need to convert each field by them self. Example:
What solution would you like?
OpenAPI supports the format field. https://swagger.io/docs/specification/data-models/data-types/#string I suggest using the format field to define the actual type of the field. So for
search.throttled
the format would beboolean
,suggest.total
would beint64
andwarmer.total_time
would beduration
.What alternatives have you considered?
Another way would be to define pattern but this would make it more complicated and does not really serve the job.
Do you have any additional context?
Another question would be if fields that are not returned by default should be of type
["string", "null"]
as they are not present in every response?