I am using Elastic search 2.4.4 (compatible with spring boot 1.5.2).
I have a document object that has the following structure:
{
id : 1,
title : Doc title
//some more metadata
sections :[
{
"id" : 2,
"title: Sec title 1,
sections:[...]
},{
id : 3,
title: Sec title 2,
sections:[...]
}
]
}
Basically I want to make the headings in the document searchable (all document names, section headings and section headings at any level), and I want to be able to evaluate documents based on the level at which they match in the tree hierarchy.
My initial thought was that we used this structure:
{
titles:[
{
title : doc title,
depth : 0
},
{
title : sec title 1,
depth : 1
},
{
title : sec title 2,
depth : 1
},
......
]
}
I would like to rank documents based on the depth at which there is a match (higher depth, lower - rating).
I know the basic field-based gain, but
is there any way to do this in elastic search?
OR
Can this be done by changing the structure?