0

我需要为现有索引启用“_size”这个问题说这是可能的。但它没有提供如何做到这一点的示例。

根据“Put Mapping API”我执行了查询

curl -XPUT "localhost:9200/my_index/_mapping/my_type?pretty" -d '{
      "properties": {
        "_size": {
          "enabled": true,
          "store" : true
        }
    }
}'

并得到错误:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "No type specified for field [_size]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "No type specified for field [_size]"
  },
  "status" : 400
}

我的错误是什么?请显示此查询的正确版本。

4

1 回答 1

3

您首先需要安装mapper-size 插件

bin/elasticsearch-plugin install mapper-size

然后你就可以像这样启用它:

PUT my_index
{
  "mappings": {
    "my_type": {
      "_size": {
        "enabled": true
      }
    }
  }
}

或者

PUT my_index/_mapping/my_type
{
   "_size": {
     "enabled": true
   }
}
于 2017-07-24T05:06:17.110 回答