# Mapper attachment issues (Elasticsearch)

**URL:** <https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538>\
**Category:** Elasticsearch\
**Created:** [June 12, 2016, 2:17pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538 "2016-06-12T14:17:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [June 12, 2016, 2:17pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/1 "2016-06-12T14:17:25Z")

</div>

I have created mapper attachmet mapping as follow.

```
PUT test-2016.06.11/person/_mapping
{
    "person" : {
        "properties" : {
            "file" : {
                "type" : "attachment",
                "fields" : {
                    "content" : {"store" : "yes"},
                    "title" : {"analyzer" : "chinese", "store" : "yes"},
                    "date" : {"store" : "yes"},
                    "author" : {"analyzer" : "chinese", "store" : "yes"},
                    "keywords" : {"analyzer" : "chinese","store" : "yes"},
                    "content_type" : {"store" : "yes"},
                    "content_length" : {"store" : "yes"},
                    "language" : {"analyzer" : "chinese", "store" : "yes"}
                }
            }
        }
    }
}

```

However, when I go through the data I put into the index, I could not see any `.raw` field. How should I change my mapping to make .raw field possible in kibana?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2016, 4:52pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/2 "2016-06-12T16:52:09Z")

</div>

There is no raw field because you did not find any.

I think multi field does not work with mapper attachment plugin but you could try to define one.

The best option is to extract data on your side then send to Elasticsearch whatever doc/mapping you want... Or wait for 5.0 which will provide ingest attachment plugin.

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [June 12, 2016, 5:01pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/3 "2016-06-12T17:01:42Z")

</div>

> [@dadoonet](#):
>
> The best option is to extract data on your side then send to Elasticsearch whatever doc/mapping you want

May you explain a bit more on this part?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2016, 5:14pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/4 "2016-06-12T17:14:54Z")

</div>

If you code in Java, use Apache Tika for example.

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [June 12, 2016, 5:16pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/5 "2016-06-12T17:16:49Z")

</div>

Does that mean if I just inserting data in Sense directly, there will be no ways to create the raw field?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2016, 7:03pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/6 "2016-06-12T19:03:47Z")

</div>

Not sure about what you mean.

If you want to create a raw field, add it to your doc:

```
PUT index/type/1
{
  "raw": "value"
}
```

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [June 13, 2016, 1:22am UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/7 "2016-06-13T01:22:57Z")

</div>

Oh, what I meant to say is to create **field.raw** in Kibana for data in mapper attachment like what the logstash will do for input data with default elasticsearch output template. Thanks.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/f/fec83aa163875af130d6444f49cc0430150dbcfc.PNG)

Also, is there anyway I can create a url mapping inside the index for my attachment?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 13, 2016, 4:54am UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/8 "2016-06-13T04:54:40Z")

</div>

You could apply the same template logstash is applying.

But why do you want to have that on an attachment field? Does not make sense to me to index a full document without any analyzer.

And I doubt it will work as I think that multfield is not supported in attachment plugin (might be wrong though).

---

<div class="post-metadata">

**Author:** ![Kennedy\_Kan1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Kennedy\_Kan1](https://discuss.elastic.co/u/Kennedy_Kan1)\
**Post date:** [June 13, 2016, 4:17pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/9 "2016-06-13T16:17:49Z")

</div>

How should I change my mapping then? I don't know how should I change my mapping template to make them create that raw field like logstash applying. I would like that field as I want to make some dashboard on it

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/3afd03b7be78e620c708f18f96d2aa0946e31985.PNG)

I have an author named cythia chiu and another named nicholas chow. But as you can see from the figure, my author name has been splited up. So how can I make them not splited up?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 13, 2016, 5:21pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/10 "2016-06-13T17:21:40Z")

</div>

Mark this field as `not_analyzed`.

---

<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 5, 2017, 10:44pm UTC](https://discuss.elastic.co/t/mapper-attachment-issues-elasticsearch/52538/11 "2017-07-05T22:44:15Z")

</div>


