gpt4 book ai didi

elasticsearch - Kibana和_source字段,弹性版本6.7

转载 作者:行者123 更新时间:2023-12-03 01:27:54 25 4
gpt4 key购买 nike

我想要一个基于我的索引的简单饼图。但是,结果中的字段似乎嵌入在_source字段中,不能在Kibana的术语汇总中使用。
enter image description here

示例结果如下所示:

enter image description here

现在,如果我禁用映射中的_source字段:

enter image description here

我没有的任何字段:

enter image description here

但是,“Kibana Discover”页面列出了可用字段,当启用_source时,ES结果从不返回这些字段。

enter image description here

索引映射如下所示:

{
"settings": {
"analysis": {
"filter": {
"filter_stemmer": {
"type": "stemmer",
"language": "english"
}
},
"analyzer": {
"tags_analyzer": {
"type": "custom",
"filter": [
"standard",
"lowercase",
"filter_stemmer"
],
"tokenizer": "standard"
}
}
}
},
"mappings": {
"schemav1": {
"properties": {
"user_id": {
"type": "text"
},

"technician_query": {
"analyzer": "tags_analyzer",
"type": "text"
},
"staffer_queries": {
"analyzer": "tags_analyzer",
"type": "text"
},
"status":{
"type":"text"
}
}
}
}
}

最佳答案

好的,原因很简单,为了在聚合中使用您的字段,您需要使用keyword版本。您无法汇总text字段。

将您的映射转换为此:

  "mappings": {
"schemav1": {
"properties": {
"user_id": {
"type": "keyword"
},

"technician_query": {
"analyzer": "tags_analyzer",
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"staffer_queries": {
"analyzer": "tags_analyzer",
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"status":{
"type":"keyword"
}
}
}
}

因此, user_idstatus现在是 keyword,而 technician_query.rawstaffer_queries.raw也是“关键字”字段,您可以在术语汇总中使用它们,因此也可以在饼图中使用。

关于elasticsearch - Kibana和_source字段,弹性版本6.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57522823/

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