Elasticsearch 错误:406 | Content-Type heade [xxx] is not supported --- 采坑

问题描述:

      使用curl 执行 es 命令时,出现错误 406,排查是因为 头部 没有 指定格式。


curl -s -XPOST "${ES_HOST}:9210/_cluster/reroute" -d "{
    \"commands\": [
       {
         \"allocate\": {
           \"index\": \"${INDEX}\",
           \"shard\": ${SHARD},
           \"node\": \"${NODE}\",
           \"allow_primary\": true
         }
       }
     ]
  }";

解决如下:

    在curl指令后 添加 : -H "Content-Type: application/json" ,即可。


curl -H "Content-Type: application/json"  -XPOST "${ES_HOST}:9210/_cluster/reroute" -d "{
    \"commands\": [
       {
         \"allocate\": {
           \"index\": \"${INDEX}\",
           \"shard\": ${SHARD},
           \"node\": \"${NODE}\",
           \"allow_primary\": true
         }
       }
     ]
  }";

其他:

      Elasticsearch recovery.RecoveryFailedException: [xxx][0]: Recovery failed on {node-1} --- 采坑

      Elasticsearch 清除 unssigned,解决 red 问题 --- 采坑

猜你喜欢

转载自blog.csdn.net/qq_41497111/article/details/92804277