# How to index a large file with Elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-index-a-large-file-with-elasticsearch/36288>\
**Category:** Elasticsearch\
**Created:** [December 3, 2015, 12:57pm UTC](https://discuss.elastic.co/t/how-to-index-a-large-file-with-elasticsearch/36288 "2015-12-03T12:57:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasif.subair](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@hasif.subair](https://discuss.elastic.co/u/hasif.subair)\
**Post date:** [December 3, 2015, 12:57pm UTC](https://discuss.elastic.co/t/how-to-index-a-large-file-with-elasticsearch/36288/1 "2015-12-03T12:57:20Z")

</div>

Hi,

I have a large file saved in pdf format in Hadoop. I want to index file contents and other file informations. I was looking around the web and finally stumbled on this [here](http://pradeeppant.com/2015/09/implementing-mapper-attachment-in-elasticsearch/?wb48617274=F1059F7A).

But here they are indexing the file by encoding the file with Base64 and saving the file to a json and creating the index from this json file.

Now what if my file has a size of say 1GB, wouldn't it take me a long time doing Base64 encoding on the file without using hadoop and creating index on it.

So my question what is most efficient way to index a large file in Hadoop with Elasticsearch.

---

<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:** [December 3, 2015, 2:03pm UTC](https://discuss.elastic.co/t/how-to-index-a-large-file-with-elasticsearch/36288/2 "2015-12-03T14:03:00Z")

</div>

As you are probably coding in Java, you should definitely read the file from hadoop and send it to Apache Tika then to extract the text you want to index.

Then send this extracted text (and only that) to elasticsearch.

My 2 cents.

---

<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, 11:33pm UTC](https://discuss.elastic.co/t/how-to-index-a-large-file-with-elasticsearch/36288/3 "2017-07-05T23:33:51Z")

</div>


