在elasticsearch API上重新索引脚本问题

unhi4e5o  于 2023-06-21  发布在  ElasticSearch
关注(0)|答案(1)|浏览(160)

我有重新索引脚本的问题,我不知道我的问题在哪里,

curl -k -uelastic:"password" -H 'Content-Type:application/json' -XPOST localhost:9200/_reindex?pretty -d'{
    "source": 
    {
      "remote": 
      {
        "host": "http://10.0.1.3:9200",
        "username": "elastic",
        "password": "password"
      }
        "index": "$n"
    }
    "dest": 
    {
      "index": "$n"
    }

  }'

在执行脚本时,我有以下错误:

{   "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[10:10] Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 10, column: 10]"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[9:7] [reindex] failed to parse field [source]",
    "caused_by" : {
      "type" : "x_content_parse_exception",
      "reason" : "[10:10] Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 10, column: 10]",
      "caused_by" : {
        "type" : "json_parse_exception",
        "reason" : "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 10, column: 10]"
      }
    }   },   "status" : 400

我找不到这样的:“对我来说,一切都应该很好。

tjrkku2a

tjrkku2a1#

你少了一个逗号

"remote": 
  {
    "host": "http://10.0.1.3:9200",
    "username": "elastic",
    "password": "password"
  },                       <---- on this line
    "index": "$n"
},                         <---- and also here
"dest": 
{

相关问题