Visualization for nested aggregations

I am trying to create a visualization in Kibana from a Nested Aggregation but I am not finding the way.

What I did now was to adapt another aggregation to be able to add a nested field and it brings me the desired results if I query ElasticSearch directly.

Below are the index definition and the mentioned aggregation.

Do I have any way to create a visualization from that query?
What other way do I have?

Index:
{
"hotelssearch": {
"mappings": {
"properties": {
"beginDt": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"checkIn": {
"type": "date"
},
"checkOut": {
"type": "date"
},
"clientConfiguration": {
"type": "nested",
"properties": {
"duplicatesRemove": {
"type": "boolean"
},
"timeout": {
"type": "long"
}
}
},
"clientName": {
"type": "keyword"
},
"contractId": {
"type": "integer"
},
"countryCode": {
"type": "keyword"
},
"destinationId": {
"type": "integer"
},
"destinationName": {
"type": "keyword"
},
"endDt": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"login": {
"type": "keyword"
},
"occupancy": {
"type": "keyword"
},
"resultsCount": {
"type": "integer"
},
"searchId": {
"type": "keyword"
},
"searchTime": {
"type": "integer"
},
"suppliersDiscardedByBusinessRules": {
"type": "nested",
"properties": {
"detailedMessage": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ruleType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"supplierId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"supplierName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"suppliersEnabled": {
"type": "nested",
"properties": {
"supplierId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"supplierName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"userId": {
"type": "integer"
}
}
}
}
}

Aggregation:
{
"aggs" : {
"suppliersEnabledCount" : {
"nested" : {
"path" : "suppliersEnabled"
},
"aggs" : {
"suppliers_Enabled_Count" : { "terms" : { "field" : "suppliersEnabled.supplierName.keyword" } }
}
}
},
"size": 0,
"_source": {
"excludes":
},
"stored_fields": [
"*"
],
"script_fields": {
"timeSpent": {
"script": {
"source": "(doc['endDt'].value.millis - doc['beginDt'].value.millis)/1000",
"lang": "painless"
}
},
"hasResults": {
"script": {
"source": "doc['resultsCount'].value > 0 ? 'Si' : 'No'",
"lang": "painless"
}
}
},
"docvalue_fields": [
{
"field": "beginDt",
"format": "date_time"
},
{
"field": "checkIn",
"format": "date_time"
},
{
"field": "checkOut",
"format": "date_time"
},
{
"field": "endDt",
"format": "date_time"
}
],
"query": {
"bool": {
"must": ,
"filter": [
{
"match_all": {}
}
],
"should": ,
"must_not":
}
}
}

Kibana does not aggregate on nested documents: https://www.elastic.co/guide/en/kibana/current/nested-objects.html

However, if you can build a query directly, you can potentially use the Vega visualization which supports direct querying. https://www.elastic.co/blog/custom-vega-visualizations-in-kibana

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.