定义 ElasticSearch Mapping

官方解析可以看这里:https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html

IK 相关内容可以看这里:https://github.com/medcl/elasticsearch-analysis-ik/

以下是优买吧的:

POST: /ymb

POST: /ymb/promotion/_mapping
{
    "promotion": {
        "_all": { "enabled": false },
        "properties": {
            "type": { "type": "byte" },
            "cid": { "type": "integer" },
            "root_cid": { "type": "integer" },
            "mall_type": { "type": "byte" },
            "mall_pid": { "type": "string", "index": "not_analyzed" },
            "title": {
                "type": "string",
                "analyzer": "ik_smart",
                "search_analyzer": "ik_smart",
                "term_vector": "no",
                "store": "false"
            },
            "feature": {
                "type": "string",
                "analyzer": "ik_smart",
                "search_analyzer": "ik_smart",
                "term_vector": "no",
                "store": "false"
            },
            "body": {
                "type": "string",
                "analyzer": "ik_smart",
                "search_analyzer": "ik_smart",
                "term_vector": "no",
                "store": "false"
            },
            "price": { "type": "integer" },
            "monthsales": { "type": "integer" },
            "transrate": { "type": "integer" },
            "commission": { "type": "byte" },
            "updated": { "type": "date" }
        }
    }
}

测试时用了 ik 作为中文分词库