# Fscrawler/Elasticsearch page by page indexing

**URL:** https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972
**Category:** Elasticsearch
**Created:** [June 28, 2019, 5:26am UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972 "2019-06-28T05:26:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Gael\_Latouche](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gael_latouche/32/48982_2.png) [@Gael\_Latouche](https://discuss.elastic.co/u/Gael_Latouche)
#### Post date: [June 28, 2019, 5:26am UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/1 "2019-06-28T05:26:13Z")

</div>

Hello,

My question is, can we index page by page of PDFs with fscrawler directly. E.g, can fscrawler do the parent/child relationship while indexing the docs and then, when doing the search query in Elasticsearch, it returns page result and not the full document.

Thanks for your precious help.

G.

---

<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 28, 2019, 5:41am UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/2 "2019-06-28T05:41:37Z")

</div>

Welcome.

No it can not. AFAIK Tika does not produce page per page extraction sadly.

---

<div class="post-metadata">

### Author: ![tallison](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tallison](https://discuss.elastic.co/u/tallison)
#### Post date: [June 28, 2019, 5:19pm UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/3 "2019-06-28T17:19:46Z")

</div>

If you're rolling your own, you can get the XHTML output from Tika, and we do mark page breaks in PDFs as \<div class="page"\>\</div\> so you should be able to parse out the contents per page.

---

<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 28, 2019, 5:46pm UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/4 "2019-06-28T17:46:31Z")

</div>

Super interesting @tallison. Do you think I can then ask an `xhtml` output from Tika, then read it and for each `<div class="page"></div>` I can find, send the content to Tika again to extract all the page content?

That could be a great addition to FSCrawler...

---

<div class="post-metadata">

### Author: ![tallison](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tallison](https://discuss.elastic.co/u/tallison)
#### Post date: [June 28, 2019, 6:10pm UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/5 "2019-06-28T18:10:40Z")

</div>

It is simpler than that. Just use the ToXMLContentHandler to get an XML String, and then run a SAXParser (or JSoup in case we're not getting our tags right :D) against that xml, and parse the content per page. No need to send anything back to Tika.

I can demo it for you pretty easily...

---

<div class="post-metadata">

### Author: ![tallison](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tallison](https://discuss.elastic.co/u/tallison)
#### Post date: [June 28, 2019, 6:12pm UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/6 "2019-06-28T18:12:20Z")

</div>

And, while you're working with parent/child documents, can I interest you in the RecursiveParserWrapper, e.g. [https://issues.apache.org/jira/browse/SOLR-7229](https://issues.apache.org/jira/browse/SOLR-7229) 😁

---

<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 26, 2019, 6:24pm UTC](https://discuss.elastic.co/t/fscrawler-elasticsearch-page-by-page-indexing/187972/7 "2019-07-26T18:24:57Z")

</div>

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