What is an Elasticsearch mapping?

To understand Elasticsearch Mappings you can read the article here.

How can I view the current mappings?

There are two ways you can view the current mappings on your Logit ELK Stacks.

Using Kibana Dev Tools

One way is to use dev tools in Kibana. You can access Kibana from any of your dashboards by choosing from your dashboard Stack settings > Access Kibana.

Once Kibana has opened you need to choose Dev Tools in the left-hand menu.

kibana dev tools

In the console section of the screen, we are going to enter the following command.

GET _all/_mapping

You should get an output similar to that of the screenshot below. Here you can see all the mappings currently used on the Elasticsearch server.

elasticsearch server mappings

Using Kibana Dev Tools to retrieve the mappings of a specific index name

You can also search for a specific mapping of an Index name. For example, if we wanted to see the mappings for a Filebeat index name we can run the following to return only the desired mappings.

You can also search for the specific mappings of an index name. First, we will get the names of our indices and then secondly we will use index name to view the indices mappings.

First, run the following;

GET _cat/indices

This should give an output similar to the below screenshot:

get indices

From here we can then choose an index-name from the third column of information. For this example, I have chosen the index-name filebeat-2019.05.17.

We can now use this to get the mappings by running the following command in Kibana Deb Tools.

GET filebeat-2019.05.17/_mapping

This will give an output similar to the screenshot below:

get filebeat example

Using the Mapping API

The second way to review the mappings currently in use is to use the mapping API. To do this you will need your Elasticsearch endpoint address and your ApiKey. These can be accessed from your dashboard by choosing Stack Settings > Elasticsearch.

Elasticsearch API access

The next step is to write a curl -x get command to retrieve the mappings from Elasticsearch.

curl -X GET your-elasticsearch-endpoint-address-es.logit.io/_all/_mapping?your-api-key&pretty

You will be returned with a JSON output similar to the below screenshot.

JSON output

Using the Mapping API to retrieve the mappings of a specific index name

Similar to Kibana Dev Tools you can also use the Mapping API to retrieve the mappings of a specific index-name.

To do so you will need to know the name of the index, so first we need to retrieve the names of our indices by running the following command.

curl -X GET your-elasticsearch-endpoint-address-es.logit.io/_cat/indices?your-api-key&pretty

Once the command has been run you will get an output similar to the screenshot below:

Elasticsearch Curl output

Now we can select the index-name from the third column of information and use it to retrieve the mappings. So again in the below example, I have used the index-name of filebeat-2019.05.17.

curl -X GET your-elasticsearch-endpoint-address-es.logit.io/filebeat-2019.05.17/_mapping?your-api-key&pretty

This will return an output similar to that of the below screenshot:

elasticsearch curl get

What's next?

Did this answer your question?