gpt4 book ai didi

node.js - 如何在关键字映射中使用标准搜索分析器?

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

我必须不将search_analyzer与文本结合使用,而与type关键字结合使用如下:

"properties":{

"email" : {
"type" : "keyword",
"analzer":"autocomplete",
"search_analyzer":"standard"
}
}

但是实际上我有下面的映射:
 "properties":{

"email" : {
"type" : "keyword",
}
}

最佳答案

分析器只能使用text类型,不能使用keyword类型。因此,您无法在关键字字段上定义search_analyzer。但是,您可以做的是创建一个文本类型的子字段,如下所示:

PUT your-index/_mapping
{
"properties": {
"email": {
"type": "keyword",
"fields": {
"analyzed": {
"type": "text",
"analyzer":"autocomplete",
"search_analyzer":"standard"
}
}
}
}
}

完成后,您需要更新数据,以便 email.analyzed字段正确索引。您可以这样做:
POST your-index/_update_by_query

当 call 返回时, email.analyzed字段将被 autocomplete分析器正确索引,并且您将能够使用 standard搜索分析器对其进行搜索。

关于node.js - 如何在关键字映射中使用标准搜索分析器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61812756/

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