I'm new to ElasticSearch and it's NEST client for C#. Apparently the min_doc_count for composite aggregations is not implemented, and I should use a script in the request to achieve the result, see: https://github.com/elastic/elasticsearch/issues/32452#issuecomment-408769861.
However when I try to implement this in C#, I'm getting the following error:
"Type: class_cast_exception Reason: "Cannot cast from [boolean] to [java.lang.Number].""
My code looks like this:
ISearchResponse<FooBar> duplicateBucket = _elasticClient.Search<FooBar>(
s => s
.Aggregations(a => a
.Composite("dupe_bucket", c => c
.Sources(b => b
.Terms("foo", x => x
.Field("foo"))
.Terms("bar", x => x
.Field("bar")))
.Size(1000)
.Aggregations(e => e
.BucketScript("bucket_selector", d => d
.BucketsPath(f => f
.Add("counter", "_count"))
.Script("params.counter > 1"))))));
If I remove the second aggregation, the call will succeed, so clearly I'm doing something wrong in the BucketScript part.
Any help would be appreciated!
BucketSelector
instead ofBucketScript
. – Val