# Indexing and querying large text documents with multiple term occurences

**URL:** https://discuss.elastic.co/t/indexing-and-querying-large-text-documents-with-multiple-term-occurences/202360
**Category:** Elasticsearch
**Created:** [October 4, 2019, 2:58pm UTC](https://discuss.elastic.co/t/indexing-and-querying-large-text-documents-with-multiple-term-occurences/202360 "2019-10-04T14:58:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vstevenson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vstevenson/32/54354_2.png) [@vstevenson](https://discuss.elastic.co/u/vstevenson)
#### Post date: [October 4, 2019, 2:58pm UTC](https://discuss.elastic.co/t/indexing-and-querying-large-text-documents-with-multiple-term-occurences/202360/1 "2019-10-04T14:58:32Z")

</div>

Hi,

I am indexing books and some long web pages in ElasticSearch. My ElasticSearch documents have a field 'content' that is extremely long with multiple occurrences of my search terms. Using the highlight tool of Elastic, is it possible to show the multiple occurences of a match within the same document?

Ex: seeing the phrase: "Quick brown fox" on pages 1,13,53, 102 of the same document, ES will return snippets of all those occurences?

Is there a better way to do this?

Thanks!

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [October 4, 2019, 3:03pm UTC](https://discuss.elastic.co/t/indexing-and-querying-large-text-documents-with-multiple-term-occurences/202360/2 "2019-10-04T15:03:19Z")

</div>

For book-size texts I'd be tempted to break it into multiple elasticsearch documents and search those.  
They can be grouped back into books in various ways at query-time but it will certainly help with highlighting to have smaller docs.

---

<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: [November 1, 2019, 3:03pm UTC](https://discuss.elastic.co/t/indexing-and-querying-large-text-documents-with-multiple-term-occurences/202360/3 "2019-11-01T15:03:23Z")

</div>

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