NEST/Elasticsearch.Net version: 6.5.0
Elasticsearch version: 6.5.4
Description of the problem including expected versus actual behavior:
I've created a composite aggregation query in the NEST client where I use 3 fields as key (let's call them _x_, _y_ & _z_). These fields are missing in some of my documents, hence Elasticsearch returns the following after key:
"after_key" : {
"x" : "Some value",
"y" : null,
"z" : null
}
The CompositeBucketAggregate.AfterKey property in the result contains a correct CompositeKey, with 3 keys and 3 values (2 of them are null). But when I add this CompositeKey to the next request via CompositeAggregationDescriptor.After(), the query it produces contains only 1 key:
"after": {
"x": "Some value"
}
So the null values are missing in the request, and Elasticsearch will give me an error saying I didn't provide enough values for the key.
I guess this happens because of some default JSON serialization (where null values are not included in the JSON). Is there a way to override this behavior? Or is this a bug in the NEST client?
Thanks for opening @joostvz, this is a bug in NEST.
Generally, NEST does not send null values to Elasticsearch but in this case it should.
I've opened #3605 to address
Closing this; will be in the next released version, 6.6.0
Most helpful comment
Closing this; will be in the next released version,
6.6.0