# Attachment field type parsed properly but cant see metadata in iformation

**URL:** <https://discuss.elastic.co/t/attachment-field-type-parsed-properly-but-cant-see-metadata-in-iformation/18601>\
**Category:** Elasticsearch\
**Created:** [July 11, 2014, 1:53pm UTC](https://discuss.elastic.co/t/attachment-field-type-parsed-properly-but-cant-see-metadata-in-iformation/18601 "2014-07-11T13:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Marko](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@David\_Marko](https://discuss.elastic.co/u/David_Marko)\
**Post date:** [July 11, 2014, 1:53pm UTC](https://discuss.elastic.co/t/attachment-field-type-parsed-properly-but-cant-see-metadata-in-iformation/18601/1 "2014-07-11T13:53:51Z")

</div>

I'm uploading attachments to be parsed in ES using Java api. I have ES  
1.2.2 with proper elasticsearch-mapper-attachments/ plugin installed. Code  
works fine and I can search by attachment content but ...

1. File content is stored into elastic search. Is there a way how to avoid  
this? Just to index the content but not store?

I have this mapping code (not full code):

XContentBuilder map = jsonBuilder().startObject()  
.startObject(idxType)  
.startObject("properties")  
.startObject("file")  
.field("type", "attachment")  
.field("store","no")  
.endObject()  
.endObject()  
.endObject();

```
and indexing by using this:

```

BytesReference json = jsonBuilder()  
.startObject()  
.field("\_id", filePath)  
.field("file", data64)  
.endObject().bytes();

IndexResponse idxResp = client.prepareIndex().setIndex(idxName).setType(  
idxType).setId(filePath)

1. I cant see file metadata created as described in docs. I understand  
that they are (should be) created automaticly ?

Docs says these fields should appear ...

"fields" : {  
"file" : {"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"}  
}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5a29d66f-99d8-48e4-b93c-7caf61b93214%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5a29d66f-99d8-48e4-b93c-7caf61b93214%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 11, 2014, 4:27pm UTC](https://discuss.elastic.co/t/attachment-field-type-parsed-properly-but-cant-see-metadata-in-iformation/18601/2 "2014-07-11T16:27:20Z")

</div>

1. 

As you are a Java dev, I'd recommend using directly Tika in your code and extract data as you need and produce JSON which exactly answers to your needs.  
Somehow, this: [https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L688-L695](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L688-L695)

That way, you won't need to send a full binary doc to elasticsearch just to index some meta data or raw text.

That said, you could look at Source exclude: [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)

1. 

The mapper attachment never modify source document.  
But, if you ask for stored field at search time in addition to default "\_source" field, you should get back your values.  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html#search-request-fields](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html#search-request-fields)

HTH

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 11 juillet 2014 à 15:53:54, David Marko ([dmarko484@gmail.com](mailto:dmarko484@gmail.com)) a écrit:

I'm uploading attachments to be parsed in ES using Java api. I have ES 1.2.2 with proper elasticsearch-mapper-attachments/ plugin installed. Code works fine and I can search by attachment content but ...

1. File content is stored into elastic search. Is there a way how to avoid this? Just to index the content but not store?

I have this mapping code (not full code):

XContentBuilder map = jsonBuilder().startObject()  
.startObject(idxType)  
.startObject("properties")  
.startObject("file")  
.field("type", "attachment")  
.field("store","no")  
.endObject()  
.endObject()  
.endObject();

```
and indexing by using this:

```

BytesReference json = jsonBuilder()  
.startObject()  
.field("\_id", filePath)  
.field("file", data64)  
.endObject().bytes();

IndexResponse idxResp = client.prepareIndex().setIndex(idxName).setType(idxType).setId(filePath)

1. I cant see file metadata created as described in docs. I understand that they are (should be) created automaticly ?

Docs says these fields should appear ...

## "fields" : { "file" : {"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"} }

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5a29d66f-99d8-48e4-b93c-7caf61b93214%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5a29d66f-99d8-48e4-b93c-7caf61b93214%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.53c01069.2d1d5ae9.70e%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53c01069.2d1d5ae9.70e%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:16am UTC](https://discuss.elastic.co/t/attachment-field-type-parsed-properly-but-cant-see-metadata-in-iformation/18601/3 "2017-07-06T01:16:28Z")

</div>


