gpt4 book ai didi

elasticsearch - Elasticsearch 中的字段和属性有什么区别?

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

我目前正在尝试了解字段( https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html )和属性( https://www.elastic.co/guide/en/elasticsearch/reference/current/properties.html )之间的区别。

它们都以某种方式被定义为类型/映射属性的“子字段/子属性”,两者都可以有单独的类型和分析器(据我所知),两者都通过点表示法( mappingProperty.subFieldmappingProperty.property )访问)。

文档随机使用术语“字段”和“属性”,我有这种感觉,例如:

Type mappings, object fields and nested fields contain sub-fields, called properties.



属性和(子)字段有什么区别?我如何决定我是否拥有房产或田地?

换句话说,我如何决定是否使用
{
"mappings": {
"_doc": {
"properties": {
"myProperty": {
"properties": {

}
}
}
}
}
}


{
"mappings": {
"_doc": {
"properties": {
"myProperty": {
"fields": {

}
}
}
}
}
}

最佳答案

子字段从父属性源索引。而子属性需要在文档源中具有“真实”值。

如果您的源包含真实对象,则需要创建属性。每个属性将对应于您来源的不同值。

如果您只想索引相同的值但使用不同的分析器,请使用子字段。

It is often useful to index the same field in different ways for different purposes. This is the purpose of multi-fields. For instance, a string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations:



(对不起,我觉得很难解释 =| )

关于elasticsearch - Elasticsearch 中的字段和属性有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52605536/

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