This is an example of a json file I am trying to POST into elasticsearch:
{"index": {}}
{"topic": "example1", "size": 2192, "timestamp": "2024-01-10"}
{"index": {}}
{"topic": "example2", "size": 2052, "timestamp": "2024-01-10"}
{"index": {}}
{"topic": "example3", "size": 1405, "timestamp": "2024-01-10"}
{"index": {}}
{"topic": "example4", "size": 1164, "timestamp": "2024-01-10"}
This is the command I was using when I was still in elastic v7 (and it was working):
curl -vvv -sk -u "test:password" -XPOST "https://<url>/acc-index-storage-sizes/_doc/_bulk?pretty" -H 'Content-Type: application/json' --data-binary "@outfile.json"
When I migrated to v8, I had to update my command to:
curl -s -k -H "Authorization: ApiKey $ApiKey" -XPOST "https://<api url>/acc-index-storage-sizes/_doc/_bulk?pretty" -H 'Content-Type: application/json' --data-binary "@outfile.json"
However, I keep on encountering this error:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "Malformed content, found extra data after parsing: START_OBJECT"
}
],
"type" : "illegal_argument_exception",
"reason" : "Malformed content, found extra data after parsing: START_OBJECT"
},
"status" : 400
}
Anyone familiar with this? I tried looking for documentations and it said to put _bulk but I already included it in the POST command.