How to do it...

The HTTP method to get a mapping is GET. The URL formats to get mappings are as follows:

  • http://<server>/_mapping
  • http://<server>/<index_name>/_mapping

To get a mapping from an index, we will perform the following steps:

  1. If we consider the mapping for the previous recipe, the call will be as follows:
GET /myindex/_mapping?pretty
The pretty argument in the URL is optional, but very handy to print the response output   prettily .
  1. The result returned by Elasticsearch should be as follows:
{
"myindex" : {
"mappings" : {
"properties" : {
"customer_id" : {
"type" : "keyword",
"store" : true
},
"date" : {
"type" : "date"
},
... truncated ...,
"vat" : {
"type" : "double",
"index" : false
}
}
}
}
}