namrata jaiswal
namrata jaiswal

Reputation: 1

How do we get Dintinct Field Name (not the field values) from Opensearch/ElasticSearch?

How do we get Dintinct Field Name (not the field values) from Opensearch/ElasticSearch?

{"K1": "V1", "K2": "V2", }

Response should be {K1, K2}

Could not find any anything equivalent in ES documentation

How do we get Dintinct Field Name (not the field values) from Opensearch/ElasticSearch?

Upvotes: 0

Views: 23

Answers (1)

dcolazin
dcolazin

Reputation: 1084

On probably every version of Elasticsearch you can use the index mapping API. The result will be of the form

{"index_name": { "mappings": { "field1": {...}, "field2": {...}}}}

Upvotes: 0

Related Questions