Hi Everyone,
I have a multi match query with below sample structure
{
id : 1,
name : 'random name',
tags : [
{
id : 1 ,
name : 'tag1',
},
{
id : 2 ,
name : 'tag2',
},
{
id : 3 ,
name : 'tag3',
},
{
id : 4 ,
name : 'tag34',
}
]
}
I am search on name, tag.name
, so when the search results match according to tags I want those tags array sorted according to matched results. So if I search tag3
The result should be
{
id : 1,
name : 'random name',
tags : [
{
id : 4 ,
name : 'tag34',
},
{
id : 3 ,
name : 'tag3',
},
{
id : 1 ,
name : 'tag1',
},
{
id : 2 ,
name : 'tag2',
}
]
}
I have an UI to show first 2 matched tags or first 2 random tags in search results. If the tags are matched then matched tags are supposed to be shown.
Any help would be appreciated. Thanks in advance.