[fields] 下的预期 [START_OBJECT],但 [statistics] 下的 [START_ARRAY]
Expected [START_OBJECT] under [fields], but got a [START_ARRAY] in [statistics]
我有下一个错误:
[fields] 下的预期 [START_OBJECT],但 [statistics]
下的 [START_ARRAY]
弹性搜索查询:
body={"query":{"bool":{"must":[{"range":{"@timestamp":{"lte":"2022-03-24T09:25:15.000- 03:00","gte":"2022-03-23T09:25:15.000-03:00"}}},{"匹配":{"type.keyword":"TABLE"} },{"match":{"HOSTNAME.keyword": "EQUIPO"}}],}},"aggs":{"statistics":{"fields":["COLUMN1","COLUMN2"]} }}
我希望获得 COLUMN1 和 COLUMN2 之间的相关统计数据
您的 JSON 格式错误,匹配数组后有不必要的逗号 (,)。
您的查询正确JSON是
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"lte": "2022-03-24T09:25:15.000-03:00",
"gte": "2022-03-23T09:25:15.000-03:00"
}
}
},
{
"match": {
"type.keyword": "TABLE"
}
},
{
"match": {
"HOSTNAME.keyword": "EQUIPO"
}
}
]
}
},
"aggs": {
"statistics": {
"fields": [
"COLUMN1",
"COLUMN2"
]
}
}
}
您的 JSON 格式不正确。如 Amit 所述,匹配数组后有不必要的逗号 (,)。
另外,您的关联聚合查询不正确。您在聚合正文中缺少 matrix_stats
。您需要提供如下聚合:
{
"aggs": {
"statistics": {
"matrix_stats": {
"fields": [ "COLUMN1", "COLUMN2" ]
}
}
}
}
我有下一个错误: [fields] 下的预期 [START_OBJECT],但 [statistics]
下的 [START_ARRAY]弹性搜索查询:
body={"query":{"bool":{"must":[{"range":{"@timestamp":{"lte":"2022-03-24T09:25:15.000- 03:00","gte":"2022-03-23T09:25:15.000-03:00"}}},{"匹配":{"type.keyword":"TABLE"} },{"match":{"HOSTNAME.keyword": "EQUIPO"}}],}},"aggs":{"statistics":{"fields":["COLUMN1","COLUMN2"]} }}
我希望获得 COLUMN1 和 COLUMN2 之间的相关统计数据
您的 JSON 格式错误,匹配数组后有不必要的逗号 (,)。
您的查询正确JSON是
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"lte": "2022-03-24T09:25:15.000-03:00",
"gte": "2022-03-23T09:25:15.000-03:00"
}
}
},
{
"match": {
"type.keyword": "TABLE"
}
},
{
"match": {
"HOSTNAME.keyword": "EQUIPO"
}
}
]
}
},
"aggs": {
"statistics": {
"fields": [
"COLUMN1",
"COLUMN2"
]
}
}
}
您的 JSON 格式不正确。如 Amit 所述,匹配数组后有不必要的逗号 (,)。
另外,您的关联聚合查询不正确。您在聚合正文中缺少 matrix_stats
。您需要提供如下聚合:
{
"aggs": {
"statistics": {
"matrix_stats": {
"fields": [ "COLUMN1", "COLUMN2" ]
}
}
}
}