# Mapping issue

**URL:** https://discuss.elastic.co/t/mapping-issue/347532
**Category:** Elasticsearch
**Tags:** painless
**Created:** [November 20, 2023, 1:16pm UTC](https://discuss.elastic.co/t/mapping-issue/347532 "2023-11-20T13:16:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![VirusProtect](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virusprotect/32/127766_2.png) [@VirusProtect](https://discuss.elastic.co/u/VirusProtect)
#### Post date: [November 20, 2023, 1:16pm UTC](https://discuss.elastic.co/t/mapping-issue/347532/1 "2023-11-20T13:16:06Z")

</div>

Hi, I'm working with fields `changes.to` and `changes.from` in Elasticsearch. These fields sometimes hold simple strings, and other times, they are objects with various values like address, name, etc.  
I'm facing an error: "failed to parse field `[changes.from]` of type `[text]` ". This happens when the field is mapped as `text` . However, if I map it as an `object` , I encounter problems when `changes.to` and `changes.from` contain just a simple keyword.  
Can anyone suggest a solution for handling these fields ? Maybe we can write some painless script ? Or what would be the best solution ?

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [November 21, 2023, 5:37pm UTC](https://discuss.elastic.co/t/mapping-issue/347532/2 "2023-11-21T17:37:33Z")

</div>

Hi @VirusProtect,

What do you mean by handle the fields? To confirm, for the object case is it a single level object or nested:

{ name: 'Bruce', surname: 'Banner', ... }

Versus a single string case:

"Bruce Banner"

---

<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: [December 19, 2023, 5:38pm UTC](https://discuss.elastic.co/t/mapping-issue/347532/3 "2023-12-19T17:38:17Z")

</div>

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