Alternative to nested fields in Kibana

Hello everyone,

I find the best alternative to visualize nested type fields in Kibana.

Now I use this solution, but i want to know if exists another method to resolve this problem?

I define the index with one unique field named obx, because always is the same structure. When i insert the documents in this field, I add a prefix before 'obx' field.

The problem is that i have to load some documents to the same 'nhc' but different 'date'.

I create this index and documents:

put test
{
"mappings" : {
"test" : {
"properties" : {
"nhc":{"type":"integer"},
"date":{"type":"date"},
"obx":{
"properties" : {
"descr":{"type":"text"},
"value":{"type":"integer"}
}
}}
}
}
}

put test/test/1
{
"nhc":12345,
"date":"2017-05-02",
"0":{"obx":{
"descr":"weight",
"value":45
}
},
"1":{"obx":{
"descr":"lenght",
"value":185
}
}
}

put test/test/2
{
"nhc":12345,
"date":"2017-05-03",
"0":{"obx":{
"descr":"weight",
"value":46
}
},
"1":{"obx":{
"descr":"lenght",
"value":180
}
}
}

How i can resolve this to load all information in the same document but not use a nested field?

Thanks.

It's always easiest to deal with a flat structure.

because always is the same structure

Is there a reason you need that "obx" property then? If they shape is the same, why not just make it part of the document's schema?

Hello Joe_Fleming,

I don't understand how "make it part of the document SCHEMA"..

Thanks.

Sorry I wasn't clear. What I meant was, why not move those properties up to the root of the document object?

{
"nhc":12345,
"date":"2017-05-03",
"descr":"weight",
"value":46
}

Or, better, why not drop the whole description and value thing and just use prop: value?

{
"nhc":12345,
"date":"2017-05-03",
"weight": 46,
"length": 180
}

That's an easier object to work with all around.

I don't put this (1*) because in the original data i have some records, depending of the date field. In the home system i have one record for nhc and date. I thik that the best practice to load this data is with nested field, but Kibana don't accept nested fields.

In the home system i have one nhc, some dates, some obx. I want to load all this data in the same document (json) but i can't use nested fields.

(1*)

{
"nhc":12345,
"date":"2017-05-03",
"weight": 46,
"length": 180
}

1 Like

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