gpt4 book ai didi

performance - 对于产品属性的索引,更多的短文本字段与更少的字段以及更多的单词

转载 作者:行者123 更新时间:2023-12-02 22:47:37 25 4
gpt4 key购买 nike

我计划使用Elasticsearch索引产品属性。每个文档应具有约60个固定字段。我正在阅读有关tuning for search speed的文档。它提到当 query_string multi_match 查询针对更多字段时,性能会变慢。该语句适用于匹配 match_phrase 查询吗?

示例

查询1:

{
"mappings": {
"properties": {
"case_color": {
"type": "text", // keyword type is not flexible enough in my case
},
"case_finish": {
"type": "text",
}
}
}
}

{
"query": {
"bool": {
"must": [
{
"match": {
"case_color": {
"query": "blue"
}
}
},
{
"match": {
"case_finish": {
"query": "polished"
}
}
}
]
}
}
}

查询2:
{
"mappings": {
"properties": {
"case": {
"type": "text",
},
}
}
}
{
"query": {
"bool": {
"must": [
{
"match": {
"case": {
"query": "blue color"
}
}
},
{
"match": {
"case": {
"query": "polished finish"
}
}
}
]
}
}
}

将案例颜色和完成属性放到一个大字段“案例”中,比将它们拆分到不同字段中更好吗?

但是,通过将所有与大小写相关的属性放入“case”字段中,它将包含更多的单词:
case: blue color, brushed and matte finish, plastic material

通过将它们分成不同的字段,每个字段将具有更少的单词:
case_color: blue
case_finish: brushed and matte
material: plastic

我想知道哪种方法更好。

最佳答案

我将比上面讨论的内容更进一步:放弃自由文本,仅使用关键字(不是映射意义上的-您可以继续使用text)。我的意思是:

case_color: "blue"
case_finish: ["brushed", "matte"] <---
material: "plastic"

关于performance - 对于产品属性的索引,更多的短文本字段与更少的字段以及更多的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60368773/

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