# Map field as Object and Text

**URL:** <https://discuss.elastic.co/t/map-field-as-object-and-text/119708>\
**Category:** Elasticsearch\
**Created:** [February 13, 2018, 9:23pm UTC](https://discuss.elastic.co/t/map-field-as-object-and-text/119708 "2018-02-13T21:23:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cappy](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@cappy](https://discuss.elastic.co/u/cappy)\
**Post date:** [February 13, 2018, 9:23pm UTC](https://discuss.elastic.co/t/map-field-as-object-and-text/119708/1 "2018-02-13T21:23:00Z")

</div>

Is there any way to map a field as an object AND text, similar to what you can do with "fields" and text and keyword types?

I'm having an issue where a field is mapped differently across indices, because Winlogbeat expects a field to be cast as a type of "object", but I have other logs where the field is cast as a type of "text".

Thanks,  
Cappy

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 13, 2018, 9:49pm UTC](https://discuss.elastic.co/t/map-field-as-object-and-text/119708/2 "2018-02-13T21:49:46Z")

</div>

Have you defined this in a/the template?

---

<div class="post-metadata">

**Author:** ![cappy](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@cappy](https://discuss.elastic.co/u/cappy)\
**Post date:** [February 13, 2018, 10:04pm UTC](https://discuss.elastic.co/t/map-field-as-object-and-text/119708/3 "2018-02-13T22:04:12Z")

</div>

Yes, I have.

This is related to my other question, actually.

I have an LS-managed template (index\_pattern of `logstash-beats-*`) I use (with everything statically mapped) that has the "user" field mapped as an object, with different properties, etc and an order of `1`

I have another LS-managed template I use (index\_pattern of `["logstash-*", "-*beats*"]` that has a "user" field from some other logs, that is set as a type of "text" and an order of `0`. The logs that use this template provide a text only value.

I've tried:

Setting the field to a type of object in the `logstash-*` template, which doesn't work because it has a concrete single value.

```
"user":{
   "type":"object"
},

```

Using "fields" to add a type of object, so that the field will be indexed w/ multi-fields.

```
"user":{
        "type":"text",
        "fields": {
          "object":{
            "type":"object"
         }
     }
  },

```

In the `logstash-beats-*` template, it is defined as follows:

```
"user": {
          "properties": {
            "domain": {
              "type": "keyword"
            },
            "identifier": {
              "type": "keyword"
            },
            "name": {
              "type": "keyword"
            },
            "type": {
              "type": "keyword"
            }
          }
        },

```

Thanks,  
Cappy

---

<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:** [March 13, 2018, 10:04pm UTC](https://discuss.elastic.co/t/map-field-as-object-and-text/119708/4 "2018-03-13T22:04:18Z")

</div>

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