Get all field names (keys) in an index

In my GUI I want to show all the keys as suggestions. How can I get these keys from elasticsearch using (node js) elasticsearch npm

Hey,

you can use the Get Mapping API to get all your fields.

--Alex

In this i am getting all scripts and all mappings. Cant I simply this to get only field names???

`curl -XGET 'http://172.16.5.115:9200/ramya_testing/_mapping/'?pretty=true
{
"ramya_testing" : {
"mappings" : {
"CDRtime" : {
"properties" : {
"CDRtime" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"logs" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"@version" : {
"type" : "string"
},
"aggs" : {
"properties" : {
"Field names" : {
"properties" : {
"terms" : {
"properties" : {
"field" : {
"type" : "string"
},
"size" : {
"type" : "long"
}
}
}
}
}
}
},
"column1" : {
"type" : "string"
},
"column10" : {
"type" : "string"
},
"column11" : {
"type" : "string"
},
"column12" : {
"type" : "string"
},
"column13" : {
"type" : "string"
},
"column14" : {
"type" : "string"
},
"column15" : {
"type" : "string"
},
"column16" : {
"type" : "string"
},
"column17" : {
"type" : "string"
},
"column18" : {
"type" : "string"
},
"column2" : {
"type" : "string"
},
"column20" : {
"type" : "string"
},
"column21" : {
"type" : "string"
},
"column23" : {
"type" : "string"
},
"column24" : {
"type" : "string"
},
"column25" : {
"type" : "string"
},
"column26" : {
"type" : "string"
},
"column27" : {
"type" : "string"
},
"column28" : {
"type" : "string"
},
"column29" : {
"type" : "string"
},
"column3" : {
"type" : "string"
},
"column30" : {
"type" : "string"
},
"column31" : {
"type" : "string"
},
"column32" : {
"type" : "string"
},
"column33" : {
"type" : "string"
},
"column34" : {
"type" : "string"
},
"column35" : {
"type" : "string"
},
"column36" : {
"type" : "string"
},
"column38" : {
"type" : "string"
},
"column39" : {
"type" : "string"
},
"column4" : {
"type" : "string"
},
"column40" : {
"type" : "string"
},
"column41" : {
"type" : "string"
},
"column42" : {
"type" : "string"
},
"column43" : {
"type" : "string"
},
"column44" : {
"type" : "string"
},
"column45" : {
"type" : "string"
},
"column46" : {
"type" : "string"
},
"column47" : {
"type" : "string"
},
"column48" : {
"type" : "string"
},
"column49" : {
"type" : "string"
},
"column5" : {
"type" : "string"
},
"column50" : {
"type" : "string"
},
"column51" : {
"type" : "string"
},
"column52" : {
"type" : "string"
},
"column53" : {
"type" : "string"
},
"column54" : {
"type" : "string"
},
"column55" : {
"type" : "string"
},
"column56" : {
"type" : "string"
},
"column57" : {
"type" : "string"
},
"column58" : {
"type" : "string"
},
"column59" : {
"type" : "string"
},
"column6" : {
"type" : "string"
},

.......................... and so on

1 Like

That is the Get mapping API, so you are using the correct endpoint already. I dont understand your question then? Where is your problem of using that API?

Very thanks. That get mapping solves it