Elasticsearch 6.8.6 _bulk API does not recognize parameter include_type_name

We have an application that can send _bulk requests to elasticsearch(I cannot modify what it sends), but is failing because the type is missing and it appears that [include_type_name] is not supported by the _bulk API. We are currently on Elasticsearch 6.8.6.

Is this intended behavior?

Request:

POST /_bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }

Response:

{
  "error": {
    "root_cause": [
    {
      "type": "action_request_validation_exception",
      "reason": "Validation Failed: 1: type is missing;"
    }
  ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: type is missing;"
  },
  "status": 400
}

Request:

 POST /_bulk?include_type_name=false
 { "index" : { "_index" : "test", "_id" : "1" } }
 { "field1" : "value1" }

Response:

{
  "error": {
    "root_cause": [
  {
    "type": "illegal_argument_exception",
    "reason": "request [/_bulk] contains unrecognized parameter: [include_type_name]"
  }
    ],
    "type": "illegal_argument_exception",
    "reason": "request [/_bulk] contains unrecognized parameter: [include_type_name]"
  },
  "status": 400
}

_type is missing or upgrade to Elasticsearch 7.x and you don't have to specify _type:

POST /_bulk
{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
{ "field1" : "value1" 

Are you using the Java client 6.8 on an older version of elasticsearch by any chance?
Or a 7.x Java client?

Could you describe a bit more?

I'm aware that type is deprecated in 7.x.
I am following recommendations for upgrade path by going from 6.3.2, to 6.8.6(current), and then will move to 7.x when I've transitioned some settings.
https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0
In 6.8.6 however there is a parameter that can be used to ease transition called "include_type_name".

My question is, why isn't the "include_type_name" recognized as parameter for the bulk index API, as it is for the single document API? Or is it supposed to be working and there is a bug?

For example, single doc request:

PUT /test?include_type_name=false

Response:

{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "test"
}

I am running these commands from 6.8.6 Kibana dev console to 6.8.6 Elasticsearch.

I don't think either the Bulk API or the single-document Index API accept the ?include_type_name parameter in any released versions, and this is deliberate. PUT /test is the create index API and that does accept this parameter in 6.8 and 7.x, but that's nothing to do with indexing documents.

Ah yes, you are correct. I was clearly getting the two confused. Thanks for clearing that up.

1 Like

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