Elasticsearch5.6:[reindex]无法解析字段[script]

时间:2017-09-18 09:47:30

标签: elasticsearch

我阅读了教程to "Custom type field", 当我运行此代码时: the code

报告错误: the error

我希望有人可以帮助我。谢谢。

  [1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html#_parent_child_without_mapping_types

1 个答案:

答案 0 :(得分:1)

I recently bumped into this, but my solution was a little different.

I believe the ElasticSearch documentation here concerning scripting with reindex might be incorrect, or at least it did not work for me.

Instead of using source in the following:

"script": {
    "source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
    "lang": "painless"
  }

I had to use inline:

"script": {
    "inline": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
    "lang": "painless"
  }

And then, worked like a charm. Checked with raw HTTP requests and python ElasticSearch client. This was on ElasticSearch version 5.5.1.