欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

elasticsearch mapping

程序员文章站 2022-07-05 13:59:27
...

settings
number_of_shards: 分片数,不可动态修改,尽量过度设置,以便扩展
number_of_replicas:副本数,可动态修改
analyzer:由filter、tokenizer组成
tokenizer:把一句换分词多个词条,决定了如何分词,词条数量。
filter:分词之后对每个词条进行过滤。
mapping
type:index type id决定一条文档,中的type
dynamic:可不可以动态生成表结构
_source.excludes:一条文档的原始数据(json)中不存储的字段列表,查询结果中也不包含。
store:下面没有列出,字段是否存储在索引中,默认是false。

{  
    "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":{  

    }  
}