Enable _size for exist index

。_饼干妹妹 提交于 2019-12-12 04:12:56

问题


I need to enable "_size" for an exist index. This question talks that it's possible. But it provides no example how to do it.

According to "Put Mapping API" I executed query

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

and got error:

{
  "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
}

What my mistake is? Please, show the correct version of this query.


回答1:


You first need to install the mapper-size plugin:

bin/elasticsearch-plugin install mapper-size

Then you'll be able to enable it like this:

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

or

PUT my_index/_mapping/my_type
{
   "_size": {
     "enabled": true
   }
}


来源:https://stackoverflow.com/questions/45269524/enable-size-for-exist-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!