elasticsearch mapping

来源:互联网 发布:ubuntu vim 新建文件 编辑:程序博客网 时间:2024/06/02 13:45

1 可以直接在索引建立时设置

PUT customer{    "mappings": {        "individual": {          "properties": {            "name": {              "type": "String"            }          }        }    }}

2 可以在索引建立后补充

PUT customer/_mapping/individual{    "properties":{        "name":{            "type":"String"        },        "age":{            "type":"short"        },        "address":{            "type":"String"        }    }}

注:
1 这里“name”已经存在了,其”type”如果是string则不会出错,如果类型变了则提示:

"mapper [name] of different type, current_type [string], merged_type [ObjectMapper]"

2 es 2.4以下版本不存在”text”类型,改为”string”

0 0
原创粉丝点击