Es6:

{
"mappings": {
    "doc": {
        "properties": {
            "a": {
                "properties": {
                    "b": {
                        "type": "text",
                        "fields": {
                            "keyword": {
                                "type": "keyword",
                                "ignore_above": 256
                            }
                        },
                        "fielddata": true
                    }
                }
            }
        }
    }
}
}

Es7:

{
"mappings": {
    "properties": {
        "a": {
            "properties": {
                "b": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    },
                    "fielddata": true
                }
            }
        }
    }
}
}

完整命令操作:
curl -XPUT "server:port/test001" -d "{"mappings":{"properties":{"a":{"properties":

{\"b\":{\"type\":\"text\",\"fields\":{\"keyword\": 
{\"type\":\"keyword\",\"ignore_above\":256}},\"fielddata\":true}}}}}}"

Es6中需要带着type层,Es7中需要去掉type层

标签: Elasticsearch, es6与es7区别, mapping

添加新评论