Error in Re-Index Documentation

https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html

The script example here is apparently incorrect. ES does not accept the triple quotes.

As far as I can see it should be single quotes with the script all on one line.

"script": {
    "source": "ctx._source.type = ctx._type;ctx._id = ctx._type + '-' + ctx._id;ctx._type = 'doc';"
  }

The documentation is generally written in the syntax accepted by Kibana Console (formally known as Sense). Kibana Console accepts scripts surrounded by triple double-quotes so you can write scripts that span multiple lines so they are easier to read. Console flattens these scripts to a single line and replaces the triple double-quotes with single double-quotes when it sends the request to Elasticsearch. If you are sending requests from outside of Console then you are right that you need to use single double-quotes and the script needs to be on one line.

2 Likes

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