Elasticsearch Filteraggregationen nach minimaler Anzahl von Dokumenten
ch bin wirklich neu in der Elasticsearch-Wel
Angenommen, ich habe eine verschachtelte Aggregation in zwei Feldern:field1
undfield2
:
{
...
aggs: {
field1: {
terms: {
field: 'field1'
},
aggs: {
field2: {
terms: {
field: 'field2'
}
}
}
}
}
}
Dieser Code funktioniert perfekt und gibt mir so etwas:
aggregations: {
field1: {
buckets: [{
key: "foo",
doc_count: 123456,
field2: {
buckets: [{
key: "bar",
doc_count: 34323
},{
key: "baz",
doc_count: 10
},{
key: "foobar",
doc_count: 36785
},
...
]
},{
key: "fooOO",
doc_count: 423424,
field2: {
buckets: [{
key: "bar",
doc_count: 35
},{
key: "baz",
doc_count: 2435453
},
...
]
},
...
]
}
}
Nun, ich muss alle Aggregationsergebnisse ausschließen, bei denendoc_count
ist zum Beispiel kleiner als 1000 und erhält stattdessen Folgendes:
aggregations: {
field1: {
buckets: [{
key: "foo",
doc_count: 123456,
field2: {
buckets: [{
key: "bar",
doc_count: 34323
},{
key: "foobar",
doc_count: 36785
},
...
]
},{
key: "fooOO",
doc_count: 423424,
field2: {
buckets: [{
key: "baz",
doc_count: 2435453
},
...
]
},
...
]
}
}
Ist es möglich, diesen Bedarf im Abfragekörper festzulegen? oder muss ich den filter im aufruferlayout ausführen (in meinem fall in javascript)?
Danke im Vorau