Elasticsearch _mapping

http方式创建mapping:
PUT my_index/my_type/_mapping
{
    "properties": {
        "category": {
            "type": "long",
            "index": "not_analyzed"
        },
        "connection": {
            "type": "long",
            "index": "not_analyzed"
        },
        "time": {
            "type": "long",
            "index": "not_analyzed"
        },
        "user": {
            "type": "string",
            "index": "not_analyzed"
        },
        "ip": {
            "type": "ip",
            "index": "not_analyzed"
        }
    }
}
注:
"index": "not_analyzed" 指定字段不分词
默认 Elasticsearch 对 text 类型的字段是不可聚合的,基本类型可聚合

mapping type可参考官方

原文地址:https://www.cnblogs.com/stellar/p/9914182.html