# Object to string gets indexed as object in elasticsearch

**URL:** <https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282>\
**Category:** Logstash\
**Created:** [September 22, 2016, 3:43pm UTC](https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282 "2016-09-22T15:43:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![derEremit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dereremit/32/12082_2.png) [@derEremit](https://discuss.elastic.co/u/derEremit)\
**Post date:** [September 22, 2016, 3:43pm UTC](https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282/1 "2016-09-22T15:43:52Z")

</div>

I need to convert a field to string so it does not create multiple fields and subfields in elasticsearch.

Reason is I get logs from a source I can't control and they are in the format

```
data: {
  23423432_23434343: { ... }
}
data: {
 450546540_3450345: { ... }
}

```

and thousands of that

so I now have thousands of fields in kibana which basically makes it unusable

so i created in my logstash conf

```
if [plaindata] {
    mutate {
      convert => { "plaindata" => "string" }
    }
  }

```

but I still get plaindata.foo.bar.baz fields

is what I tried the correct way to handle this problem?  
What I need is plaindata as a searchable field as it can contain valuable debug information

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 22, 2016, 5:11pm UTC](https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282/2 "2016-09-22T17:11:14Z")

</div>

Maybe the json\_encode filter could be useful?

---

<div class="post-metadata">

**Author:** ![derEremit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dereremit/32/12082_2.png) [@derEremit](https://discuss.elastic.co/u/derEremit)\
**Post date:** [September 25, 2016, 6:34pm UTC](https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282/3 "2016-09-25T18:34:17Z")

</div>

that worked, thanks

---

<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:** [July 6, 2017, 4:37am UTC](https://discuss.elastic.co/t/object-to-string-gets-indexed-as-object-in-elasticsearch/61282/4 "2017-07-06T04:37:07Z")

</div>


