Reputation: 485
I am trying to bulk index using jq, and having trouble.
I enter the following using the terminal (I'm using Ubuntu 16.04)
cat practice.json | jq -c '.[] | {"index": {"_index": "text", "_type": "text", "_id": "text"}}, .' | curl -XPOST localhost:9200/_bulk --data-binary @-
This is the error that I get:
{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"not_x_content_exception: Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}}
Oddly, I was able to get similar code (I forgot to save what I did, but I think it is the same as this) to work. I couldn't find anyone with the same problem here or elsewhere. Any idea on how to fix this?
Upvotes: 0
Views: 3509
Reputation: 108
This sounds like an issue with the document sent to jq. ElasticSearch requires the outermost document to be a JSON object and not a JSON array or scalar value. Just make sure it is...
Check this out: ElasticSearch error while sending data
Upvotes: 1