Hi,
I am trying to store key value pairs into Elasticsearch and visualize in Kibana. I am new to Elastic so sorry if the question is dumb.
So here's my data
{
"mappings": {
"properties": {
"Topics": {"type": "nested"}
}
}
}
{
"id" : 1,
"Topics": [
{"Topic_Name": "Topic 1", "Topic_Score": 1},
{"Topic_Name": "Topic 2", "Topic_Score": 2 }
]
}
{
"id" : 2,
"Topics": [
{"Topic_Name": "Topic 1", "Topic_Score": 1 },
{"Topic_Name": "Topic 2", "Topic_Score": 2 }
]
}
When I add the documents as above for some reason the topics name doesnt even show up in Available fields on Kibana.
So tried to add them as a object instead of nested field
{
"mappings": {
"properties": {
"Topics": {"type": "object"}
}
}
}
{
"id" : 1,
"Topics": [
{"Topic_Name": "Topic 1", "Topic_Score": 1},
{"Topic_Name": "Topic 2", "Topic_Score": 2 }
]
}
{
"id" : 2,
"Topics": [
{"Topic_Name": "Topic 1", "Topic_Score": 1 },
{"Topic_Name": "Topic 2", "Topic_Score": 2 }
]
}
As per this elastic document it says the relation would be lost.
To test it out I tried displaying a BAR chart by the topics as bars and the sum as their values but the sum field always sums the whole Topic score but does not divide the topics scores based on the topics
I know in the vertical axis it says sum of the whole topic score, But how do I divide the sum with respect to its topic? I dont see any formula to divide it by topics
Please advise where i am going wrong am I suppose to model the data in a different manner all together? If so please advise how I should do it. I've looked at other threads and they say the key value pairs should be a separate document but I dont understand how to do it.