Parent Child link in dashboard


(Wouter Badenhorst) #1

Hello everyone

I have a parent child relationship in my data and on my dashboard I would like to display the parents in a data table and below it I would like to display the children related to that parent.

How can I achieve this ? I'm looking for a way to pass the parent id down to the children table and filter that table to show just the child records belonging to that parent. Or any other way that someone can suggest doing this.

Thank you for your help


(Jim Unger) #2

@warper can you post a sample of your data? Ideally you would generate a script in the format for submitting a bug to the elasticsearch repo so that I can quickly recreate it in my environment.

Also, are you embedding the dashboard into another page that you control, or are you operating entirely within Kibana?

Thinking ahead, are you open to changing the way that the data is structured at index time to make this easier?


(Wouter Badenhorst) #3

Hey Jim, sorry for the delay. I'm adding a simple data structure that I'm trying to do this with so you can create it in your environment.

I just want to use ii in Kibana, no other dashboard involved.

I don't really mind changing my data structure at all this just seemed to be the right way of doing it. Let me know if you need more information. Thank you for your help

PUT library
{
"mappings": {
"books": {
"_all": {"enabled": false},
"properties":{
"title":{"type": "string"},
"name":{
"type":"nested",
"properties":{
"first":{"type":"string"},
"last":{"type":"string"}
}
},
"publish_date":{"type":"date"},
"price":{"type":"string"}
}
},
"reviews":{
"_parent": {
"type": "books"
},
"properties": {
"points":{"type":"integer"},
"reviedate":{"type":"date"}
}
}
}
}

PUT /library/books/1
{
"title": "A Fly On The Wall",
"name" : {
"first":"James",
"last":"Sanders"
},
"publish_date":"2015-06-21T23:39:49-0400",
"price": "19.19"
}

PUT /library/books/2
{
"title": "A New World",
"name" : {
"first":"Sandra",
"last":"Jones"
},
"publish_date":"2015-06-21T23:39:49-0400",
"price": "21.19"
}

PUT /library/reviews/1?parent=1
{
"points" : 6,
"reviedate" : "2015-06-21T23:39:49-0400"
}

PUT /library/reviews/2?parent=1
{
"points" : 4,
"reviedate" : "2015-06-22T23:39:49-0400"
}

PUT /library/reviews/3?parent=1
{
"points" : 9,
"reviedate" : "2015-06-23T23:39:49-0400"
}

PUT /library/reviews/4?parent=2
{
"points" : 5,
"reviedate" : "2015-06-21T23:39:49-0400"
}

PUT /library/reviews/5?parent=2
{
"points" : 7,
"reviedate" : "2015-06-22T23:39:49-0400"
}


(Jim Unger) #4

Is this the extent of the data structure that you are indexing, or did you simplify it for this example? Is there any reason why you can't index the book details along with the review? That would make it simple to accomplish what you wanted in a single dashboard.


(Wouter Badenhorst) #5

I simplified the data for the example. The intend of the review is to keep on growing as new reviews come in for the book I would just like to add them. The real world application of this would be history of a status change and the data the status changed. Thank you for looking at this


(system) #6