# Elasticsearch mapper attachment issues

**URL:** <https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464>\
**Category:** Elasticsearch\
**Created:** [June 10, 2016, 5:08pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464 "2016-06-10T17:08:26Z")\
**Posts on this page:** 17\
**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 10, 2016, 5:08pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/1 "2016-06-10T17:08:26Z")

</div>

I have created an index in Sense like this

```
PUT /test/person/_mapping
{
    "person" : {
        "properties" : {
            "file" : {
                "type" : "attachment",
                "fields" : {
                    "content" : {"index" : "no"},
                    "title" : {"store" : "yes"},
                    "date" : {"store" : "yes"},
                    "author" : {"store" : "yes"},
                    "keywords" : {"store" : "yes"},
                    "content_type" : {"store" : "yes"},
                    "content_length" : {"store" : "yes"},
                    "name" : {"store" : "yes"}
                }
            }
        }
    }
}

PUT /test/person/1
{
    "my_attachment" : {
        "_content_type" : "application/pdf",
        "_name" : "resource/name/of/my.pdf",
        "_language" : "en",
        "_content" : "44CK5pyA5L2O5bel6LOH5qKd76a144CL77yI56ysIDYwOCDnq6DvvInjgIzlt6XkvZzntpPpqZflrbjlk6HjgI3l"
    }
}

PUT /test/person/2
{
    "my_attachment" : {
        "_content_type" : "application/pdf",
        "_title" : "Letter_of_confirmation_work_experience_student",
        "_name" : "Confirmation of student status for “work experience student” ",
        "_author" : "Labour Department",
        "_date" : "11/06/2016",
        "_keywords" : "工作經驗學員",
        "_content" : "44CK5pyA5L2O5bel6LOH5qKd76a144CL77yI56ysIDYwOCDnq6DvvInjgIzlt6XkvZzntpPpqZflrbjlk6HjgI3lrbjnlJ/ouqvku73norroqo3mm7gNCkNvbmZpcm1hdGlvbiBvZiBzdHVkZW50IHN0YXR1cyBmb3Ig4oCcd29yayBleHBlcmllbmNlIHN0dWRlbnTigJ0NCnVuZGVyIHRoZSBNaW5pbXVtIFdhZ2UgT3JkaW5hbmNlIChDYXAuIDYwOCkNCumgiOefpeS6i+mghQ0KTm90ZQ0KMSDjgIzlt6XkvZzntpPpqZflrbj2IOatsuOAgg0KVGhlIENvbmZpcm1hdGlvbiBvZiBzdHVkZW50IHN0YXR1cyBmb3Ig4oCcd29yayBleHBlcmllbmNlIHN0dWRlbnTigJ0gKOKAnENvbmZpcm1hdGlvbuKAnSkgYXBwbGllcyB0byBhIHdvcmsNCmVpcyB1bmRlciB0aGUgYWdlIG9mIDI2IHllYXJzLg0KMiDms5XlrprmnIDkvY7lt6Xos4fvpafpgannlKjmlrzmraPomZXmlrznjbLosYHlhY3lrbjnlJ/lg7HnlKjmnJ/nmoTlt6XkvZzntpPpqZflrbjlk6HvvIzlg7HkuLvmoLnmk5rjgIrlg7Hlgq3mop3vprXjgIvvvIjnrKw1N+eroO+8iemgiA0K5YKZ5a2Y5pWZ6IKy5qmf5qeL55m85Ye655qE5paH5Lu25oiW5YW25Ymv5pys77yM5Lul6aGv56S66Kmy5bel5L2c57aT6am"
    }

```

I have got 2 questions for that  
**1. After I create the index in Sense, I try also to create index in kibana. But why couldn't I see any incoming hits in the "Discover" Page.**  
![Create test index in Kibana]][1](http://i.stack.imgur.com/VRsnP.png)

[![No result for hits](http://i.stack.imgur.com/G4gA2.png)](http://i.stack.imgur.com/G4gA2.png)

**Q2. How can I read back the decode format of the file content?**

---

<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 10, 2016, 8:24pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/2 "2016-06-10T20:24:04Z")

</div>

Q1. May be you define an index with a timestamp?

May be run a query like `GET test/_search` and see what is coming from this?

If it has not been indexed, you probably got an error.

Q2. You can't. You have to decode yourself the BASE64 content. Or you have to store the content field (means you need to change the mapping).

Another thing: this plugin is deprecated. Prepare yourself to move to 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 11, 2016, 4:44am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/3 "2016-06-11T04:44:10Z")

</div>

1. How can I define the index with timestamp?
2. Also, when I follow the document of mapper attachment [https://www.elastic.co/guide/en/elasticsearch/plugins/master/mapper-attachments-usage.html](https://www.elastic.co/guide/en/elasticsearch/plugins/master/mapper-attachments-usage.html)

```auto
    PUT /test/person/_mapping
    {
        "person" : {
            "properties" : {
                "file" : {
                    "type" : "attachment",
                    "fields" : {
                        "content" : {"index" : "no"},
                        "title" : {"store" : "yes"},
                        "date" : {"store" : "yes"},
                        "author" : {"analyzer" : "myAnalyzer"},
                        "keywords" : {"store" : "yes"},
                        "content_type" : {"store" : "yes"},
                        "content_length" : {"store" : "yes"},
                        "language" : {"store" : "yes"}
                    }
                }
            }
        }
    }

```

It gives me the result

> {  
> "error": {  
> "root\_cause": [  
> {  
> "type": "mapper\_parsing\_exception",  
> "reason": "analyzer [MyAnalyzer] not found for field [author]"  
> }  
> ],  
> "type": "mapper\_parsing\_exception",  
> "reason": "analyzer [MyAnalyzer] not found for field [author]"  
> },  
> "status": 400  
> }

How this happen? And why the content could not be indexed?

---

<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 11, 2016, 5:38am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/4 "2016-06-11T05:38:38Z")

</div>

1/ I don't know what it means and how it's related to mapper attachment plugin.

2/ you did not create an analyzer called MyAnalyzer, right?

---

<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 11, 2016, 5:54am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/5 "2016-06-11T05:54:23Z")

</div>

For q1, I want to find back my record so can I create dashboard in kibana for my records.  
For q2, Yes I didnt create it. How should I create one? And from the mapping template, what does the word “store” mean and how can I create an timestamp because when I try to insert timestamp in mapping, it gives me error result

---

<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 11, 2016, 7:26am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/6 "2016-06-11T07:26:23Z")

</div>

You don't need a timestamp to visualize data in Kibana.

If you don't need a specific analyzer, don't define it.

Store means that the content of this field will be stored in Lucene.

---

<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 11, 2016, 7:41am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/7 "2016-06-11T07:41:02Z")

</div>

Then what is the analyzer used for? And why could not the content be set to “index”: “yes”?

---

<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 11, 2016, 8:08am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/8 "2016-06-11T08:08:35Z")

</div>

You might want to read: [https://www.elastic.co/guide/en/elasticsearch/guide/current/languages.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/languages.html)

About store, what is the error message you are getting?

---

<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 11, 2016, 9:20am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/9 "2016-06-11T09:20:35Z")

</div>

Yea, I have solved the analyzer problem.

As for the store and index problem, it is as shown as the follow

 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/c6174900ce27a00f37f79e7d647a7dcf4e979418.PNG)  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/2/2d017ec7b4c4e4f46339b46807d85e683df6d236.PNG)

As seen, I can't create index on content.

---

<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 11, 2016, 9:37am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/10 "2016-06-11T09:37:03Z")

</div>

Please don't copy images.

Try this

```auto
    PUT /test/person/_mapping
    {
        "person" : {
            "properties" : {
                "file" : {
                    "type" : "attachment",
                    "fields" : {
                        "content" : { "store" : true }
                    }
                }
            }
        }
    }

```

---

<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 11, 2016, 10:57am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/11 "2016-06-11T10:57:51Z")

</div>

Is there any ways I could get the data created in elasticsearch to Kibana for making dashboard. Although I have made data in Sense and input to elasticsearch now, I could not get back any data in Kibana

---

<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 11, 2016, 11:11am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/12 "2016-06-11T11:11:34Z")

</div>

Probably depends on how you set your index in Kibana.

Better to ask IMO in #kibana room...

---

<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 11, 2016, 3:39pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/13 "2016-06-11T15:39:46Z")

</div>

```
PUT /test/person/2
{
    "my_attachment" : {
        "_content_type" : "application/pdf",
        "_title" : "Letter_of_confirmation_work_experience_student",
        "_name" : "Confirmation of student status for “work experience student” ",
        "_author" : "Labour Department",
        "_date" : "11/06/2016",
        "_keywords" : "工作經驗學員",
        "_content" : "44CK5pyA5L2O5bel6LOH5qKd76a144CL77yI56ysIDYwOCDnq6DvvInjgIzlt6XkvZzntpPpqZflrbjlk6HjgI3lrbjnlJ/ouqvku73norroqo3mm7gNCkNvbmZpcm1hdGlvbiBvZiBzdHVkZW50IHN0YXR1cyBmb3Ig4oCcd29yayBleHBlcmllbmNlIHN0dWRlbnTigJ0NCnVuZGVyIHRoZSBNaW5pbXVtIFdhZ2UgT3JkaW5hbmNlIChDYXAuIDYwOCkNCumgiOefpeS6i+mghQ0KTm90ZQ0KMSDjgIzlt6XkvZznt"
    }

```

I would wanna also know why it will give me error of "reason": "No content is provided." when I miss out the `_` before the 'content'.

---

<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 11, 2016, 4:59pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/14 "2016-06-11T16:59:24Z")

</div>

> [@Kennedy\_Kan1](#):
>
> I would wanna also know why it will give me error of "reason": "No content is provided." when I miss out the \_ before the 'content'.

It's the way it works and have been designed.

---

<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, 9:18am UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/15 "2016-06-12T09:18:51Z")

</div>

> [@dadoonet](#):
>
> You might want to read: [Dealing with Human Language | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/languages.html)

How can I set the analyzer to both chinese or english?

---

<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, 1:13pm UTC](https://discuss.elastic.co/t/elasticsearch-mapper-attachment-issues/52464/16 "2016-06-12T13:13:57Z")

</div>

IIRC in recent versions multifield is not supported anymore.  
I'd either wait for 5.0.0 with the ingest-attachment plugin or do the text extraction in my application (wusing Apache Tika if you are using Java).

Or you need to create 2 indices or 2 fields, one with english analyzer the other one with chinese.  
Then send the BASE64 content twice. But that's really not efficient...

---

<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/elasticsearch-mapper-attachment-issues/52464/17 "2017-07-05T22:44:32Z")

</div>


