gpt4 book ai didi

elasticsearch - Elasticsearch 中默认禁用字段分析

转载 作者:行者123 更新时间:2023-11-29 02:43:40 26 4
gpt4 key购买 nike

是否可以为一种类型选择性地启用 Elasticsearch 字段的索引?

通过对特定索引的映射设置,可以设置属性

{ “索引”:“未分析” }

针对特定领域。由于我的文档有太多字段并且将来可能会更改结构,因此我需要一个映射,默认情况下不分析字段,除非另有说明。

这可能吗?

最佳答案

是的-看看dynamic templates

尝试以下操作:

PUT /my_index
{
"mappings": {
"my_type": {
"dynamic_templates": [
{ "notanalyzed": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
}

动态模板适用于您的映射未涵盖的新字段 - 来自文档:

With dynamic_templates, you can take complete control over the mapping that is generated for newly detected fields.

您还可以根据字段名称改变映射,例如使用 "match": "*_data",为以“_data”结尾的字段名称设置一组不同的映射。

关于elasticsearch - Elasticsearch 中默认禁用字段分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27570365/

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