elasticsearch mapping

拼音搜索 mapping

{
    "settings":{
        "number_of_shards":"5",
        "number_of_replicas":"1",
        "analysis":{
            "filter":{
                "custom_pinyin_filter":{
                    "padding_char":" ",
                    "type":"pinyin",
                    "keep_separate_first_letter":"true",
                    "first_letter":"prefix"
                }
            },
            "analyzer":{
                "ik_pinyin_analyzer":{
                    "filter":[
                        "custom_pinyin_filter",
                        "word_delimiter"
                    ],
                    "type":"custom",
                    "tokenizer":"ik_smart"
                }
            }
        },
        "search":{
            "slowlog":{
                "level":"debug",
                "threshold":{
                    "fetch":{
                        "warn":"500ms",
                        "trace":"100ms",
                        "debug":"100ms",
                        "info":"200ms"
                    },
                    "query":{
                        "warn":"500ms",
                        "trace":"100ms",
                        "debug":"100ms",
                        "info":"200ms"
                    }
                }
            }
        },
        "indexing":{
            "slowlog":{
                "level":"debug",
                "threshold":{
                    "index":{
                        "warn":"200ms",
                        "trace":"50ms",
                        "debug":"50ms",
                        "info":"100ms"
                    }
                },
                "source":"5000"
            }
        }
    },
    "mappings":{
        "type":{
            "dynamic":"false",
            "_source":{
                "excludes":[
                    "namePinyin"
                ]
            },
            "properties":{
                "name":{
                    "type":"text",
                    "analyzer":"ik_smart"
                },
                "nameInitial":{
                    "type":"keyword"
                },
                "namePinyin":{
                    "type":"text",
                    "analyzer":"ik_pinyin_analyzer"
                },
                "other":{
                    "type":"keyword"
                }
            }
        }
    },
    "aliases":{

    }
}