gpt4 book ai didi

elasticsearch - 自定义分析器不工作 Elasticsearch

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

{
"_source": {
"enabled": false
},
"analysis": {
"analyzer": {
"default": {
"type": "custom",
"tokenizer": "uax_url_email",
"filter": "lowercase,standard,stop"
}
}
},
"mappings": {
"table": {
"properties": {
"field1": {
"type": "string",
"include_in_all": false,
"index": "no"
},
"field2": {
"type": "long",
"include_in_all": false,
"index": "no"
},
"field3": {
"type": "string",
"index": "analyzed"
}
}
}
}
}

分析仪在测试时似乎不起作用。分析器不应该索引停用词,它还应该索引整个电子邮件地址。当我“测试分析​​器”并输入“ jack 很好”时,所有三个单词的索引都会发生。我不希望它索引英语中的停用词,例如“and”、“is”等。

最佳答案

您将字段设置为 "index": "no"并禁用 include_in_all .您如何期望将某些内容放入索引中?引自 documentation :

no means that it won’t be searchable at all (as an individual field; it may still be included in _all). Setting to no disables include_in_all.



而实际的 settings应该是这样的(您的索引定义中缺少 "settings"):
{
"_source": {
"enabled": false
},
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "custom",
"tokenizer": "uax_url_email",
"filter": "lowercase,standard,stop"
}
}
}
},
"mappings": {
"table": {
"properties": {
"field1": {
"type": "string",
"include_in_all": false,
"index": "no"
},
"field2": {
"type": "long",
"include_in_all": false,
"index": "no"
},
"field3": {
"type": "string",
"index": "analyzed"
}
}
}
}
}

关于elasticsearch - 自定义分析器不工作 Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30702701/

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