Getting a mapping
After having set our mappings for processing types, we sometimes need to control or analyze the mapping to prevent issues. The action to get the mapping for a type helps us to understand the record structure, or its evolution due to merging and implicit type guessing.
Getting ready
You will need a working ElasticSearch cluster and the mapping created in the previous recipe.
How to do it...
The HTTP method to get a mapping is GET.
The URL formats for getting a mapping are:
http://<server>/_mapping http://<server>/<index_name>/_mapping http://<server>/<index_name>/<type_name>/_mapping
To get a mapping from the type of an index, we will perform the following steps:
If we consider the type order of the previous chapter, the call will be:
curl -XGET 'http://localhost:9200/myindex/order/_mapping?pretty=true'
The
pretty
argument in the URL willpretty
print the response output.The result returned by ElasticSearch should be:
{ "myindex" : { "mappings...