# Issue with the fileds.env value

**URL:** <https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [April 3, 2019, 1:55pm UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216 "2019-04-03T13:55:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![syedsfayaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syedsfayaz/32/46657_2.png) [@syedsfayaz](https://discuss.elastic.co/u/syedsfayaz)\
**Post date:** [April 3, 2019, 1:55pm UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/1 "2019-04-03T13:55:05Z")

</div>

Hi

I have been installing beats by categorizing then with a field value.

I used integer value on all my beats. Now when I am trying to use a string value I see errors.  
fields:  
env: 10.6

Can I not use multiple data types for fields.env value.  
fields:  
env: Stage

`|2019-04-03T06:43:14.423-0700|WARN|elasticsearch/client.go:539|Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Time{wall:0xbf214bfb96b57b90, ext:869286001, loc:(*time.Location)(0x2b2ed00)}, Meta:common.MapStr(nil), Fields:common.MapStr{"fields":common.MapStr{"env":"systems"}, "beat":common.MapStr{"name":"88888", "hostname":"8888888", "version":"6.7.0"}, "host":common.MapStr{"name":"888888", "architecture":"x86_64", "os":common.MapStr{"build":"9600.18684", "platform":"windows", "version":"6.3", "family":"windows", "name":"Windows Server 2012 R2 Standard"}, "id":"ce032784-436a-4022-aeff-5feb9ac6015d"}, "event":common.MapStr{"dataset":"system.memory"}, "system":common.MapStr{"memory":common.MapStr{"swap":common.MapStr{"total":0x22bf8d000, "used":common.MapStr{"bytes":0xf37ab000, "pct":0.4379}, "free":0x1387e2000}, "total":0x1dff8d000, "used":common.MapStr{"bytes":0xf4067000, "pct":0.5084}, "free":0xebf26000, "actual":common.MapStr{"free":0xebf26000, "used":common.MapStr{"pct":0.5084, "bytes":0xf4067000}}}}, "metricset":common.MapStr{"name":"memory", "module":"system"}}, Private:interface {}(nil)}, Flags:0x0} (status=400): {"type":"mapper_parsing_exception","reason":"failed to parse field [fields.env] of type [float]","caused_by":{"type":"number_format_exception","reason":"For input string: \"systems\""}}|`

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [April 4, 2019, 8:47am UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/2 "2019-04-04T08:47:08Z")

</div>

Hi,

I don't think it is possible. In Elasticsearch all fields are mapped to a type(like text, long, float,...) and the type is validated when inserting new data.

What you could do: separe the fields in the beats config:

> ```
> fields:
> env: stage
> version: 10.6
> 
> ```

This creates two fields in elasticsearch (fields.env, fields.version) which can have different types.

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![syedsfayaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syedsfayaz/32/46657_2.png) [@syedsfayaz](https://discuss.elastic.co/u/syedsfayaz)\
**Post date:** [April 4, 2019, 3:03pm UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/3 "2019-04-04T15:03:07Z")

</div>

@Wolfram_Haussig

Is there a way I can add a number to field. env like 10.6 and define it as a string and not an integer. Or by default beats considers this as an integer?

---

<div class="post-metadata">

**Author:** ![syedsfayaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syedsfayaz/32/46657_2.png) [@syedsfayaz](https://discuss.elastic.co/u/syedsfayaz)\
**Post date:** [April 4, 2019, 3:45pm UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/4 "2019-04-04T15:45:19Z")

</div>

@Wolfram_Haussig  
Is there a way I can add a number to field. env like 10.6 and define it as a string and not an integer. Or by default beats considers this as an integer?

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [April 5, 2019, 5:07am UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/5 "2019-04-05T05:07:08Z")

</div>

Hi,

By default Elasticsearch recognises the type of a field on the first occurence in a log entry which would be float I guess(see supported types here: [Data Types | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-data-types.html)).  
If you want 10.6 as a string the following should do:

> ```
> fields:
> env: stage
> version: "10.6"
> 
> ```

Another possibility(More powerful but bit more complex) would be to create a custom index template: [Index templates | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

---

<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 3, 2019, 5:07am UTC](https://discuss.elastic.co/t/issue-with-the-fileds-env-value/175216/6 "2019-05-03T05:07:10Z")

</div>

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