0

I want to create a new template in Elastic search with a json file which located in /root directory.

I run the following:

curl -X PUT 'localhost:9200/_template/template_1?pretty' -H 'Content-Type: application/json' -d /root/myjson

It gives me the following error:

Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes

What is the correct way to send curl command with data that is placed in specific file?

MIDE11
  • 3,140
  • 7
  • 31
  • 53

1 Answers1

0

The error you are receiving appears to be an ElasticSearch response, not a CURL error.

Based on this example, I would suspect that the issue may be malformed JSON:

ElasticSearch error while sending data

You could try sending the data directly on the commandline, to see if you receive the same error, and then run your file contents through a JSON validator

Community
  • 1
  • 1
Courtney G
  • 11
  • 5