Request Body is Required

I am attempting to use the reindex API to combine indices for the month into one single index:

POST _reindex?pretty
{
  "conflicts": "proceed",
  "source": {
    "index": "my-index-2021.04.*"
  },
  "dest": {
    "index": "my-index-2021.04",
    "op_type": "create"
  }
}

...however, I am running into the following error in Dev Tools:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parse_exception",
        "reason" : "request body is required"
      }
    ],
    "type" : "parse_exception",
    "reason" : "request body is required"
  },
  "status" : 400
}

I did see an almost identical post about this, but no solution was provided.

Thank you!
Tim

1 Like

That looks like a correct request to me. Can you check for any errant spaces or tabs in your request? I assume you're using Dev Tools.

Yes, I'm using Dev Tools. I did see in that other post that the user having my problem was able to perform this using curl, but in my case that fails as well. Here is my curl command:

curl -XPOST "http://hot-data-node:9200/_reindex" -H 'Content-Type: application/json' -d'{  "source": {    "index": "my-index-2021.04.*"  },  "dest": {    "index": "my-index-2021.04"  }}'

But get the following output:

{"error": "Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}curl: (6) Could not resolve host: application'
curl: (6) Could not resolve host: source
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: index
curl: (6) Could not resolve host: my-index-2021.04.*
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (6) Could not resolve host: dest
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: index
curl: (6) Could not resolve host: my-index-2021.04
curl: (3)  [globbing] unmatched close brace/bracket in column 1

I also tried it in PowerShell using the following command (unsuccessfully):

Invoke-RestMethod -Method POST "http://hot-data-node:9200/_reindex" -Headers 'Content-Type: application' -Body 'Content-Type: application/json' -d'{  "source": {    "index": "my-index-2021.04.*"  },  "dest": {    "index": "my-index-2021.04"  }}'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.