# Nest always maps values in Dictionary to string

**URL:** <https://discuss.elastic.co/t/nest-always-maps-values-in-dictionary-to-string/281652>\
**Category:** Elasticsearch\
**Created:** [August 17, 2021, 8:56am UTC](https://discuss.elastic.co/t/nest-always-maps-values-in-dictionary-to-string/281652 "2021-08-17T08:56:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AaronAlluyn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaronalluyn/32/93264_2.png) [@AaronAlluyn](https://discuss.elastic.co/u/AaronAlluyn)\
**Post date:** [August 17, 2021, 8:56am UTC](https://discuss.elastic.co/t/nest-always-maps-values-in-dictionary-to-string/281652/1 "2021-08-17T08:56:16Z")

</div>

I've been trying to figure out how the dynamic mapping and templates work but not having much luck.

I have a simple app that loads in data file and maps it to a Dictionary\<string, object\>  
the values are all technically strings though, which seems to be my problem.

I upload my data to the index the simplest way possible.  
`var response = m_client.Index(data, i => i.Index(index));`

When I look at the data in elastic however, all the values are mapped to strings.

```auto
         "FooBar1" : "-2020",
          "FooBar2" : "1.320",
          "FooBar3" : "foobarvalue",

```

I read on some posts that elastic will only evaluate on first entry to the index, all my testing I create a brand new index, so that shouldn't be the issue.  
My guess is that because it's passing the data as object (which is really a string when i parse the files) it decides to keep it as that.

is there any way to force elastic to evaluate the type? as I don't know what types the values will be I don't think I can set up a mapping for it? They're all base types, nothing that elastic shouldn't be able to parse.

I looked on stackoverflow and here, but most answers that came close to my issue, I didn't understand the answer.

Thanks,  
Aaron

---

<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:** [September 14, 2021, 8:56am UTC](https://discuss.elastic.co/t/nest-always-maps-values-in-dictionary-to-string/281652/2 "2021-09-14T08:56:23Z")

</div>

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