I have a data structure that looks like this:
"dictionaryProximities": [
{
"proximity": 0.32427,
"topicDictionaryName": "Electrical",
},
{
"proximity": 0.32141,
"topicDictionaryName": "Indoor Air Quality",
},
{
"proximity": 0.7321,
"topicDictionaryName": "Smart Home Technology",
},
I want to create a filter/query that will return all files where the proximity of "Smart Home Technology" is greater than a value, say 0.7.
Right now I have the query:
{
"query": {
"nested": {
"path": "dictionaryProximities",
"query": {
"match": {
"dictionaryProximities.topicDictionaryName": {
"query": "Smart Home Technology",
"type": "phrase"
}
}
}
}
}
}
stacked with the query:
{
"query": {
"nested": {
"path": "dictionaryProximities",
"query": {
"range": {
"dictionaryProximities.proximity": {
"gte": 0.7,
"lt": 1
}
}
}
}
}
}
This returns all files with proximity above 0.7 and contain the name Smart Home Technology. This is very different from what I want, which is all files that have a proximity above 0.7 ONLY for Smart Home Technology.
My question is, is there a way to combine these two queries in a way that achieves the result I want? Is this task even possible since proximity and Name are nested in the same level? Any help would be super appreciated.