# Does NEST \[Keyword\] attribute's NullValue parameter not work?

**URL:** <https://discuss.elastic.co/t/does-nest-keyword-attributes-nullvalue-parameter-not-work/177690>\
**Category:** Elasticsearch\
**Created:** [April 20, 2019, 8:02am UTC](https://discuss.elastic.co/t/does-nest-keyword-attributes-nullvalue-parameter-not-work/177690 "2019-04-20T08:02:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxz](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jxz](https://discuss.elastic.co/u/jxz)\
**Post date:** [April 20, 2019, 8:02am UTC](https://discuss.elastic.co/t/does-nest-keyword-attributes-nullvalue-parameter-not-work/177690/1 "2019-04-20T08:02:29Z")

</div>

Hi,

I use NEST with C#. I want to index objects of my class annotated with the keyword attribute's NullValue param with auto-mapping in hope that when the field's value is null, instead of nothing being indexed for it, we can have it with a substitute value in the index. Here is the C# code snippet:

```
public class MyClass
{
    [Keyword]
    public string ID { get; set;}

    [Keyword(NullValue = "null")]
    public string CustomerID { get; set; }

    [Keyword(NullValue = "_null_")]
    public string OrderID { get; set; }
}

```

However, neither CustomerID nor OrderID are indexed when they are null, even though I can verify "null\_value": "null" or "null\_value": "_null_" is in the query DSL that NEST generates for them. I use NEST 6.6.0.

Does the NEST Keyword attribute's NullValue work? If so, what should I do differently to make it work?

---

<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:** [May 18, 2019, 8:09am UTC](https://discuss.elastic.co/t/does-nest-keyword-attributes-nullvalue-parameter-not-work/177690/2 "2019-05-18T08:09:46Z")

</div>

Closed on May 18, 2019, 8:09am UTC

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