react-elasticsearch
react-elasticsearch copied to clipboard
nested set elastic search via nestedPath="tags"
<Facet id="tags" fields={["tags.name"]} nestedPath="tags" filterValueModifier={caseInsensitiveSearch}/>
nested
{
"preference":"tags"
}{
"query":{
"bool":{
"must":[
{
"bool":{
"should":[
]
}
},
{
"bool":{
"should":[
]
}
},
{
"multi_match":{
"query":"hamburger",
"type":"phrase",
"fields":[
"name"
]
}
}
]
}
},
"size":0,
"aggs":{
"tags.name":{
"nested":{
"path":"tags"
},
"aggs":{
"tags.name":{
"terms":{
"field":"tags.name",
"order":{
"_count":"desc"
},
"size":10
}
}
}
}
},
"track_total_hits":true
}
Hi @insekticid 👋 Thank you for your contribution 🙏 . Could you explain briefly what problem it solves (i.e: why you added this). it will help me in testing and hopefully, validate it and merge it.
you can use aggregate filter with subarray key like tags.name, it is not possible without nested
"_source" : {
"name" : "Super article",
"tags" : [
{
"name" : "Top dnešní recepty",
"url" : "https://www.recepty.eu/top/",
"hashtag" : "TopDnes"
},
{
"name" : "Top týdenní recepty",
"url" : "https://www.recepty.eu/top/",
"hashtag" : "TopTýden"
},
{
"name" : "Top měsíční recepty",
"url" : "https://www.recepty.eu/top/",
"hashtag" : "TopMěsíc"
},
{
"name" : "Top recepty za rok",
"url" : "https://www.recepty.eu/top/",
"hashtag" : "TopRok"
}
],