I have some docs in elastic search
doc1 -> name: name1
doc2 -> name: name1, otherprop: prop1
doc3 -> name: name1, otherprop: prop1, otherprop2: prop2
My goal is get doc1 by name but the query return all three docs
I tried to get doc1 by name and min(count of properties) but my query is return or nothing or all match documents
{
"query": {
"bool": {
"filter": [
{ "term": { "name": "name1" }}
]
}
},
"aggs": {
"models": {
"terms": { "field": "name" }
}
}
}
How can I get only doc1 with my idea?
Thanks