enter image description here我正在使用guid值对字段进行聚合,例如c4b0c9ae-345c-4247-87e3-e9d9de67c01b,但是当弹性搜索返回聚合时 它正在成为一个阵列[" c4b0c9ae"," 345c"," 4247"," 87e3"," e9d9de67c01b" ]。 你怎么在巢上处理这个?
答案 0 :(得分:1)
该字段已映射为text
datatype,默认情况下使用Standard Analyzer在索引时进行分析。结果是通过拆分连字符将GUID标记为组成部分。您可以使用Analyze API(在Kibana控制台中)自己看到这个
GET _analyze
{
"analyzer": "standard",
"text": ["c4b0c9ae-345c-4247-87e3-e9d9de67c01b"]
}
产量
{
"tokens": [
{
"token": "c4b0c9ae",
"start_offset": 0,
"end_offset": 8,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "345c",
"start_offset": 9,
"end_offset": 13,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "4247",
"start_offset": 14,
"end_offset": 18,
"type": "<NUM>",
"position": 2
},
{
"token": "87e3",
"start_offset": 19,
"end_offset": 23,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "e9d9de67c01b",
"start_offset": 24,
"end_offset": 36,
"type": "<ALPHANUM>",
"position": 4
}
]
}
您可能不希望在索引时分析GUID,因此您应explicitly map them作为keyword datatype。