# Getting metadata of the extracted text from a file

**URL:** <https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058>\
**Category:** Elasticsearch\
**Created:** [June 22, 2018, 4:15pm UTC](https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058 "2018-06-22T16:15:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmeyRok](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@AmeyRok](https://discuss.elastic.co/u/AmeyRok)\
**Post date:** [June 22, 2018, 4:15pm UTC](https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058/1 "2018-06-22T16:15:54Z")

</div>

I have converted a pdf file into json by using tika and json library in python. While i want to search for a keyword in my index, I also want to have the page no. of the pdf file from which i extracted the data to index into elasticsearch. Is it possible? If yes, then please tell what should be my approach.  
TIA.

---

<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 23, 2018, 8:19am UTC](https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058/2 "2018-06-23T08:19:35Z")

</div>

Please update the title of your post to something more meaningful.

> I also want to have the page no. of the pdf file from which i extracted the data to index into elasticsearch. Is it possible?

Yes. But only if you know it. So it depends on how the documents you are sending to elasticsearch are looking like.  
I mean that AFAIK with Tika, you don't get that back.

For example if you send something like:

```auto
PUT book/_doc/foo
{
  "text": "bar .... bla bla ... baz"
}

```

Then there is no page number and you can't do anything about it.

But if you send

```auto
PUT page/_doc/foo_1
{
  "page": 1,
  "text": "bar"
}
PUT page/_doc/foo_2
{
  "page": 2,
  "text": "bla bla"
}
PUT page/_doc/foo_3
{
  "page": 3,
  "text": "baz"
}

```

Then it's obvious. So all the hard work has to be done on the extraction side, not on elasticsearch side.

---

<div class="post-metadata">

**Author:** ![AmeyRok](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@AmeyRok](https://discuss.elastic.co/u/AmeyRok)\
**Post date:** [June 25, 2018, 10:04am UTC](https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058/3 "2018-06-25T10:04:11Z")

</div>

Thank you so much.

---

<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 23, 2018, 10:04am UTC](https://discuss.elastic.co/t/getting-metadata-of-the-extracted-text-from-a-file/137058/4 "2018-07-23T10:04:12Z")

</div>

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