gpt4 book ai didi

elasticsearch - ElasticSearch中的模板

转载 作者:行者123 更新时间:2023-12-02 23:56:36 26 4
gpt4 key购买 nike

我对索引模板以及在创建新文档时使用此模板毫无疑问。
1.放置_template / template_1
我只提到了自定义分析的映射文件中的一个字段。

 {
"index_patterns": ["te*", "bar*"],
"settings":{
"analysis": {
"analyzer": {
"analyzer2": {
"filter": [
"standard"
],
"tokenizer": "whitespace"
},
"analyzer1": {
"filter": [
"standard"
],
"tokenizer": "tokenizer1"
}
},
"tokenizer": {
"tokenizer1": {
"min_gram": "3",
"tokenize_on_chars": [
"letter",
"digit"
],
"type": "edge_ngram",
"max_gram": "3"
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"search": {
"type": "text",

"fields": {
"analyzer1": {
"type": "text",
"analyzer":"analyzer1"
},
"analyzer2": {
"type": "text",
"analyzer":"analyzer2"
},

"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
_template/template_1

2.开机自检/ tea / _doc / 1
使用新的元数据创建此类型的新文档
{
"search":"elastic",
"metadata":"search"
}

3.获取/ tea / _doc / _mapping
当检索映射文件时,默认情况下将分析新添加的字段,而不是自定义分析字段。在文档中找到新的元数据时,默认情况下如何应用这些自定义分析器
{
"tea": {
"mappings": {
"_doc": {
"properties": {
"metadata": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"search": {
"type": "text",
"fields": {
"analyzer1": {
"type": "text",
"analyzer": "analyzer1"
},
"analyzer2": {
"type": "text",
"analyzer": "analyzer2"
},
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}

最佳答案

根据analyzer documentation的定义,如果您将分析器命名为“default”,它将被用作默认分析器。

从文档中:

At index time, Elasticsearch will look for an analyzer in this order:

  • The analyzer defined in the field mapping.
  • An analyzer named default in the index settings.
  • The standard analyzer.

关于elasticsearch - ElasticSearch中的模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52778397/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com