2017-09-18 38 views
0

我讀的教程to "Custom type field", 當我運行這段代碼: the codeElasticsearch5.6:重新索引]無法解析領域[腳本]

報告錯誤: the error

我希望有人可以幫助我。謝謝。

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

嘗試將'script'中的'source'更新爲'inline'。看到這個:https://qbox.io/blog/reindex-documents-with-ease-without-third-party-scripts-using-elasticsearch –

回答

0

我最近碰到這個,但我的解決方案有點不同。

我相信ElasticSearch documentation herereindex有關的腳本可能不正確,或者至少它不適用於我。

除了使用在以下source的:

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

我不得不使用inline

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

然後,工作就像一個魅力。用原始HTTP請求和python ElasticSearch客戶端進行檢查。這是ElasticSearch版本5.5.1。