I am trying to index data in elastic search.
following is the version and other details about elastic search
{ "name" : "Tmqcj9W",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "HvwGfRrpR4-iaViCTm9ZwA",
"version" : {
"number" : "6.1.1",
"build_hash" : "bd92e7f",
"build_date" : "2017-12-17T20:23:25.338Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0",
}"tagline" : "You Know, for Search"}
The client side code to index data is in python:
es = ElasticSearch('http://localhost:9200/')
es.create_index(index_name)
es.bulk_index("index_name", "doc_type", [{"title":"this is title","desc":"this is description"}])
I am getting the following error.
"pyelasticsearch.exceptions.ElasticHttpError: (406, 'Content-Type header [] is not supported')"
After few searches I got few suggestions saying I need to set the content type to "application/json", but I am not sure how to set this. Can anyone help me with this ?.
Issue was with elasticsearch python library. I downgraded the version to 6. sudo pip3 install elasticsearch==6.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With