So I want to create a bar chart to display all the "name" fields of all the animal groups in the x-axis and its total "value" field in the y-axis(or vice-versa) from now to 6 months before. What will the query parameter be for this? Couldn't seem to visualize this in Kibana either: the "AnimalGroup" field wasn't available to select.
The data structure is as follows:
"hits" : [
{
"_source" : {
"AnimalGroup":[
{
"value": 12,
"name": cat
},
{
"value": 13,
"name": dog
},
],
{
"_source":{
"AnimalGroup":[
{
"value": 12,
"name": fish
},
{
"value": 50,
"name": dog
},
]
}
}
]
Mapping:
"mappings" : {
"dynamic_templates" : [ ],
"properties" : {
"AnimalGroup" : {
"properties" : {
"value" : {
"type" : "long"
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
}
EDIT: Added the mapping of the data.
You need to select
sum
aggregation onY-axis
and selectAnimalGroup.value
as field.You need to select
Terms
aggregation onX-axis
and selectAnimalGroup.name.keyword
as field.Y-axis
X-axis
Graph