Mapping types are being removed, so why am I still expected to provide type information in bulk requests?

I use ElasticSearch 6.7.0.

According to ElasticSearch documentation, mapping types are being removed.

I want to create lots of documents in a single bulk request. My JSON document looks something like this:

"index":{"_id":"1"}
"info":"1"

When I tried sending the bulk request, I saw the following error:

"type" : "action_request_validation_exception",
"reason" : "Validation Failed: 1: type is missing;"

I discovered that someone else had already encountered the same issue. The accepted answer mentioned that the type information must be present either in the URL, or inside the JSON document itself, e.g.

POST /your_index/your_type/_bulk
{"index":{"_id":"1"}}
{"info":"1"}

or

POST /_bulk
{"index":{"_index": "your_index", "_type": "your_type", "_id":"1"}}
{"info":"1"}

Why is this still necessary, even when mapping types are being removed? Is there any way I can send a bulk request without specifying the mapping type?

You must specify the type in the bulk API in 6.7.
It's deprecated in 7.0 for the bulk API.

See details of the schedule here: https://www.elastic.co/guide/en/elasticsearch/reference/6.7/removal-of-types.html

1 Like

Thank you for your prompt reply. I shall download ElasticSearch 7.0 now and give it a try. :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.