# \[C# NEST\] Query results with special characters not mapping properly

**URL:** <https://discuss.elastic.co/t/c-nest-query-results-with-special-characters-not-mapping-properly/309749>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 15, 2022, 3:07pm UTC](https://discuss.elastic.co/t/c-nest-query-results-with-special-characters-not-mapping-properly/309749 "2022-07-15T15:07:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jleonapl](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jleonapl](https://discuss.elastic.co/u/jleonapl)\
**Post date:** [July 15, 2022, 3:07pm UTC](https://discuss.elastic.co/t/c-nest-query-results-with-special-characters-not-mapping-properly/309749/1 "2022-07-15T15:07:58Z")

</div>

When performing queries on indices that have field names with special characters, they are not correctly mapped to the provided model.

Example index:

```auto
{
        "_index" : "my-index-with-special-characters",
        "_id" : "20.20.20.15",
        "_score" : 1.0,
        "_source" : {
            "host.ip" : "20.20.20.15",
            ....
}

```

Example model:

```auto
public class myModel {
    [JsonPropertyName("host.ip")]
    public string HostIp { get; set; }
}

```

Example query:

```auto
var esAssets = ElasticAuth.Client("my-index-with-special-characters")
               .Search<myModel>(s => s
                   .From(0)
                   .Size(10000)
                   .MatchAll()
               );

```

There are several fields in this index that do not have the "." character that map correctly, but each one that has the dot character does no map at all.

Is there a special way this case needs to be handled?

Thank you!

---

<div class="post-metadata">

**Author:** ![jleonapl](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jleonapl](https://discuss.elastic.co/u/jleonapl)\
**Post date:** [July 15, 2022, 4:28pm UTC](https://discuss.elastic.co/t/c-nest-query-results-with-special-characters-not-mapping-properly/309749/2 "2022-07-15T16:28:55Z")

</div>

I seemed to have found an answer. Declaring a Nest.PropertyName above each field with a special character seems to do the trick.

```auto
[Nest.PropertyName("host.ip")]
public string HostIp { get; set; }

```

---

<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:** [August 12, 2022, 4:29pm UTC](https://discuss.elastic.co/t/c-nest-query-results-with-special-characters-not-mapping-properly/309749/3 "2022-08-12T16:29:53Z")

</div>

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