gpt4 book ai didi

elasticsearch - ElasticSearch Snowball Analyzer无法与嵌套查询一起使用

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

我使用以下映射创建了索引

    PUT http://localhost:9200/test1
{
"mappings": {
"searchText": {
"properties": {
"catalogue_product": {
"type":"nested",
"properties": {
"id": {
"type": "string",
"index":"not_analyzed"
},
"long_desc": {
"type":"nested",
"properties": {
"translation": {
"type":"nested",
"properties": {
"en-GB": {
"type": "string",
"anlayzer": "snowball"
},
"fr-FR": {
"type": "string",
"anlayzer": "snowball"
}
}
}
}
}
}
}
}
}
}
}

我用了一张记录
PUT http://localhost:9200/test1/searchText/1
{
"catalogue_product": {
"id": "18437",
"long_desc": {
"translation": {
"en-GB": "C120 - circuit breaker - C120H - 4P - 125A - B curve",
"fr-FR": "Disjoncteur C120H 4P 125A courbe B 15000A"
}
}
}

}

那如果我搜索这个词

breaker





catalogue_product.long_desc.translation.en-GB



我得到添加的记录
POST http://localhost:9200/test1/searchText/_search
{
"query": {
"nested": {
"path": "catalogue_product.long_desc.translation",
"query": {
"match": {
"catalogue_product.long_desc.translation.en-GB": "breaker"
}
}
}
}

}

如果替换单词

breaker





breakers



,尽管en-GB字段在映射中具有Analyzer = snowball,但我没有任何记录
POST http://localhost:9200/test1/searchText/_search
{
"query": {
"nested": {
"path": "catalogue_product.long_desc.translation",
"query": {
"match": {
"catalogue_product.long_desc.translation.en-GB": "breakers"
}
}
}
}

}

我为此感到疯狂。我要去哪里错了?
我尝试使用英语而不是雪球将分析仪设置为新映射,但是这也不起作用:(
任何帮助表示赞赏

最佳答案

杜德,这是错字。它的分析器而不是分析器

   PUT http://localhost:9200/test1
{
"mappings": {
"searchText": {
"properties": {
"catalogue_product": {
"type":"nested",
"properties": {
"id": {
"type": "string",
"index":"not_analyzed"
},
"long_desc": {
"type":"nested",
"properties": {
"translation": {
"type":"nested",
"properties": {
"en-GB": {
"type": "string",
"analyzer": "snowball"
},
"fr-FR": {
"type": "string",
"analyzer": "snowball"
}
}
}
}
}
}
}
}
}
}
}

关于elasticsearch - ElasticSearch Snowball Analyzer无法与嵌套查询一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28630512/

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