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
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).@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:
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.