Open hokkun-dayo opened 5 years ago
Sometimes we includes single quotes in our request body of REST request (at the /#/rest page). For curl scripts, we need to escape single quotes by '\'' because the part of current codes uses single quotes for the -d option of curl command.
/#/rest
'\''
-d
Example
POST _reindex { "source": { "index": "metricbeat-*" }, "dest": { "index": "metricbeat" }, "script": { "lang": "painless", "source": "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'" } }
(from https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-reindex.html)
In this case, 'metricbeat-' should be '\''metricbeat-'\''.
'metricbeat-'
'\''metricbeat-'\''
I've already worked on this change for my forked repository, so if you agree with me I'll submit a new PR to the base repository here.
wip PR: https://github.com/hokkun-dayo/cerebro/pull/1
Sometimes we includes single quotes in our request body of REST request (at the
/#/rest
page). For curl scripts, we need to escape single quotes by'\''
because the part of current codes uses single quotes for the-d
option of curl command.Example
(from https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-reindex.html)
In this case,
'metricbeat-'
should be'\''metricbeat-'\''
.I've already worked on this change for my forked repository, so if you agree with me I'll submit a new PR to the base repository here.