# Null values in AfterKey of Composite Aggregation are ignored in NEST 6.3.0 - 6.5.0

**URL:** <https://discuss.elastic.co/t/null-values-in-afterkey-of-composite-aggregation-are-ignored-in-nest-6-3-0-6-5-0/169532>\
**Category:** Elasticsearch\
**Created:** [February 22, 2019, 8:35am UTC](https://discuss.elastic.co/t/null-values-in-afterkey-of-composite-aggregation-are-ignored-in-nest-6-3-0-6-5-0/169532 "2019-02-22T08:35:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslie.ido](https://avatars.discourse-cdn.com/v4/letter/l/22d042/32.png) [@leslie.ido](https://discuss.elastic.co/u/leslie.ido)\
**Post date:** [February 22, 2019, 8:35am UTC](https://discuss.elastic.co/t/null-values-in-afterkey-of-composite-aggregation-are-ignored-in-nest-6-3-0-6-5-0/169532/1 "2019-02-22T08:35:43Z")

</div>

Hi guys,

I'm using Composite Aggregation to summarize data. Since some fields may be missing, I set missing\_bucket = true, so the returned after\_key may contain key-value pairs with null values, like

> "after\_key" : {  
> "field1" : "blah blah",  
> "field2" : null  
> }

When \> I assigned this to Nest.CompositeAggregation.After and invoked ElasticClient.Search,  
I got errors like

> "reason": {  
> "type" : "illegal\_argument\_exception",  
> "reason" : "[after] has 1 value(s) but [sources] has 2",  
> ...  
> }

It turned out the request sent to ES changed and the key-value pair with null value in composite.after was ignored:

> "composite": {  
> "after": {  
> "field1" : "blah blah"  
> },  
> ...  
> }

I guess when I send the Nest.SearchRequest, NEST serializer just ignored null values. What should I do to let NEST internal serializer include null values in the after key of Composite Aggregation?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 22, 2019, 8:35am UTC](https://discuss.elastic.co/t/null-values-in-afterkey-of-composite-aggregation-are-ignored-in-nest-6-3-0-6-5-0/169532/2 "2019-03-22T08:35:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
