elasticsearch-dump: Content-Type header [] is not supported

In order to help us troubleshoot issues with this project, you must provide the following details:

I seem to be getting the error Content-Type header [] is not supported with Elastic 6 beta.

is there a command line argument I can add to include the content type? This isn’t a problem specific to elasticdump, it is a change in Elasticsearch 6.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30

Most upvoted comments

I answered my own question with a simple read of the documentation. I added:

--headers='{"Content-Type": "application/json"}' to the end of my command and it worked splendidly.

I am getting @maniankara error (unrecognised token):

I am sending both --type: data and --header. I get an error if I do not send the headers (same Content-Type header [] is not supported).

Wed, 13 Dec 2017 11:49:14 GMT | starting dump
Wed, 13 Dec 2017 11:49:16 GMT | got 100 objects from source elasticsearch (offset: 0)
Wed, 13 Dec 2017 11:49:16 GMT | sent 100 objects to destination file, wrote 100
Wed, 13 Dec 2017 11:49:16 GMT | Error Emitted => {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Failed to parse request body"}],"type":"illegal_argument_exception","reason":"Failed to parse request body","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'DnF1ZXJ5VGhlbkZldGNowAIAAAAAAN4jWRZQaERwb3lnaVE1NkVDVE9qSGkwVnRRAAAAAAETdU8WSU8yNjA0NDZUV0N0blgtNTlaVG9RdwAAAAAA7vGUFnBQQjkxXzdsVEpLRlVNbUNSdzdXOXcAAAAAAO7xlRZwUEI5MV83bFRKS0ZVTW1DUnc3Vzl3AAAAAADu8ZYWcFBCOTFfN2xUSktGVU1tQ1J3N1c5dwAAAAABE3VQFklPMjYwNDQ2VFdD...': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@348bd801; line: 1, column: 257]"}},"status":400}
Wed, 13 Dec 2017 11:49:16 GMT | Total Writes: 100
Wed, 13 Dec 2017 11:49:16 GMT | dump ended with error (get phase) => Error: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Failed to parse request body"}],"type":"illegal_argument_exception","reason":"Failed to parse request body","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'DnF1ZXJ5VGhlbkZldGNowAIAAAAAAN4jWRZQaERwb3lnaVE1NkVDVE9qSGkwVnRRAAAAAAETdU8WSU8yNjA0NDZUV0N0blgtNTlaVG9RdwAAAAAA7vGUFnBQQjkxXzdsVEpLRlVNbUNSdzdXOXcAAAAAAO7xlRZwUEI5MV83bFRKS0ZVTW1DUnc3Vzl3AAAAAADu8ZYWcFBCOTFfN2xUSktGVU1tQ1J3N1c5dwAAAAABE3VQFklPMjYwNDQ2VFdD...': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@348bd801; line: 1, column: 257]"}},"status":400}

@cRUSHr2012 i have the same issues that you had. Do you figured out a solution?
I tried this: elasticdump --input=http://elasticsearch.xxxx.xxxx:9200/logs-$date --output=/data/elasticsearch/index-$date.json --type=data --headers=‘{“Content-Type”: “application/json”}’

For those who get error using --headers='{"Content-Type": "application/json"}' try -H'Content-Type: application/json' instead.

when is the release?

Oke, I answered my own post. For me adding --limit=2000 as parameter works fine!

This is a required change for version 6, might make sense to have this be a default, I don’t think it has a negative impact when working with older versions.

I’ve noticed something : the error appears after the first batch of elements. If the batch is the default one (100 elements), the error appears before the second batch is processed. I can see all of the 100 documents on the destination cluster. If I use a batch of 1 element, the error appears before the second one is processed. A sample of exported (source) data with elasticdump:

{"_index":"categories-7","_type":"store_1","_id":"387","_score":1,"_source":{"parent_id":"154","path":"1/2/153/154/387","position":"1","level":"4","name":"Rame foto","thumbnail":"stsgt0abb_1.jpg","url_key":"rame-foto-clasice","display_mode":"PRODUCTS","request_path":"camere/rame/rame-foto","id":"387","status":"1","banners":["7","27"]}}
{"_index":"categories-7","_type":"store_1","_id":"166","_score":1,"_source":{"parent_id":"163","path":"1/2/153/157/163/166","position":"1","level":"5","name":"SD","thumbnail":"501.jpg","meta_description":"Carduri SD.","meta_title":"Carduri SD","meta_keywords":"carduri SD","url_key":"alte-accesorii","display_mode":"PRODUCTS","request_path":"camere-foto/accesorii-foto/carduri-memorie/alte-accesorii","id":"166","status":"1","banners":["7","27"]}}

Error: {“error”:“Content-Type header [application/x-ndjson] is not supported”,“status”:406}. This is the new error!!! I think it is my elasticsearch version to cause this problem and the version is 6.0.0.

@morgango using your solution and ‘–limit=10000’ I only can dump 10000 records , but my data more than 10000 , I need your help , thanks

I try to use -H’Content-Type: application/json’,but the same error I got Error Emitted => {“error”:“Content-Type header [] is not supported”,“status”:406}

Just an added note, might help someone. Those ones using elastic6.0 and have "reason":"Unrecognized token .... problem, I was stuck with this as I was passing the --headers='{"Content-Type": "application/json"}' option with --type=data. The type data does not need those explict --headers param, it works with that.

@JelmenGuhlke Could you share your elasticdump command here? I added the --limit=2000 to mine and the same issue persist.