gpt4 book ai didi

c# - 逗号分隔vs Elasticsearch 中的列表

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

我有一个带有数组属性的嵌套类型,

class MyType
{
public string Name{ get; set; }
public List<OtherType> Others { get; set; }
}

class OtherType
{
public string Title { get; set; }
public List<string> Tags { get; set; } // vs what follows
// public string Tags { get; set; } // eg. = "tag1, tag2, etc"
}

通常最好的方法是什么(列表与逗号分隔的标签)?这将使我更容易搜索?

最佳答案

您可以使用属性“include_in_parent”为true的嵌套对象,以便可以对嵌套对象有效地使用常规查询以及相关查询。

{   "MyType": {
"properties": {
"name": {
"type": "string"
},
"OtherType": {
"type": "nested",
"include_in_parent": true,
"properties": {
"Title": {
"type": "string"
},
"Tags": {
"type": "string"
}
}
}
} } }

关于c# - 逗号分隔vs Elasticsearch 中的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43932026/

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