gpt4 book ai didi

Elasticsearch : singular and plural results

转载 作者:行者123 更新时间:2023-11-29 02:53:21 28 4
gpt4 key购买 nike

我们在映射中使用了 minimal_english 词干过滤器。这是为了确保只有单数和复数是可搜索的,而不是相似的词。例如。 TestTests 应该在输入词条时可搜索 - Test - 但是 Tester ,测试人员,测试人员 不应该。在尝试使用以下 RESTful API 进行搜索时,multi_field 属性类型是可搜索的,但 nested 属性类型不是:

curl -X GET "http://10.113.124.136:9400/libtester/_search?pretty=true" -d '{
"query": {
"query_string": {
"query": " DescriptionDescription ",
"fields": [
"abc"
]
}
}
}'

映射如下图:

{
"properties": {
"abc": {
"type": "multi_field",
"fields": {
"c_asset_id": {
"type": "string",
"index": "analyzed",
"include_in_all": true,
"analyzer": "basic_english"
},
"untouched": {
"type": "string",
"index": "analyzed",
"include_in_all": false,
"analyzer": "string_lowercase"
}
}
},
"xyz": {
"type": "nested",
"properties": {
"c_viewpoint": {
"type": "multi_field",
"fields": {
"c_viewpoint": {
"type": "string",
"index": "analyzed",
"include_in_all": true,
"analyzer": "basic_english"
},
"untouched": {
"type": "string",
"index": "analyzed",
"include_in_all": false,
"analyzer": "string_lowercase"
}
}
}
}
},
...
}
}

这是否与嵌套类型的映射有关 - xyz,它们不能从与 multi_field 类型相同的 API 进行搜索?

最佳答案

您可以搜索嵌套属性,只是语法略有不同。您必须指定路径,然后为要搜索的每个属性显式使用该路径。

本教程有一个 good overview of how nested documents work .

关于 Elasticsearch : singular and plural results,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13971655/

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