gpt4 book ai didi

elasticsearch - 通过命令进行CURL

转载 作者:行者123 更新时间:2023-12-02 23:23:26 24 4
gpt4 key购买 nike

我想通过命令创建一个PUT列表,但是出现以下错误。

码:

curl -XPOST http://127.0.0.1:9200/lecordonbleu/documentos/_update_by_query -d '{'script':   'ctx._source.codigoTema =  '1' ; ctx._source.tema = 'ACEITES Y GRASAS'  ', 'query': {'term' : {'codigoTema' : '66'} } }';
curl -XPOST http://127.0.0.1:9200/lecordonbleu/documentos/_update_by_query -d '{'script': 'ctx._source.codigoTema = '2' ; ctx._source.tema = 'ADITIVOS ALIMENTARIOS' ', 'query': {'term' : {'codigoTema' : '67'} } }';
curl -XPOST http://127.0.0.1:9200/lecordonbleu/documentos/_update_by_query -d '{'script': 'ctx._source.codigoTema = '3' ; ctx._source.tema = 'ADMINISTRACION' ', 'query': {'term' : {'codigoTema' : '68'} } }';

错误:
Error executing script

应该注意的是,当我在Sense中运行它时,没有出现任何错误,可以正确更新。
您能帮我还是告诉我我失败了?

非常感谢你。

最佳答案

您的脚本还需要输入"inline"参数。您需要这样做:

curl -XPOST http://127.0.0.1:9200/lecordonbleu/documentos/_update_by_query -d '{"script": { "inline":  "ctx._source.codigoTema =  ''1'' ; ctx._source.tema = ''ACEITES Y GRASAS''"}, "query": {"term" : {"codigoTema" : "66"} } }';

由于您正在运行ES 1.6,因此需要执行以下操作:
curl -XPOST http://127.0.0.1:9200/lecordonbleu/documentos/_update_by_query -d '{"script": "ctx._source.codigoTema =  ''1'' ; ctx._source.tema = ''ACEITES Y GRASAS''", "query": {"term" : {"codigoTema" : "66"} } }';

并确保您已安装正确版本的 "update by query" plugin

关于elasticsearch - 通过命令进行CURL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46040676/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com