# Elastic Search 5.1.1 - How to fetch all documents that contains/ startswith operator on a field in ElasticSearch

**URL:** https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945
**Category:** Elasticsearch
**Created:** [March 11, 2021, 12:42pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945 "2021-03-11T12:42:36Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![HS161148](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@HS161148](https://discuss.elastic.co/u/HS161148)
#### Post date: [March 11, 2021, 12:42pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/1 "2021-03-11T12:42:36Z")

</div>

How to fetch all documents that contains/ startswith with value on a field in ElasticSearch.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 11, 2021, 12:52pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/2 "2021-03-11T12:52:56Z")

</div>

What is the mapping for the field in question?

---

<div class="post-metadata">

### Author: ![HS161148](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@HS161148](https://discuss.elastic.co/u/HS161148)
#### Post date: [March 11, 2021, 1:12pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/3 "2021-03-11T13:12:00Z")

</div>

Hi,

I am new to Elastic Search.. Is the below information you are looking for?

![image](https://us1.discourse-cdn.com/elastic/original/3X/6/b/6be53795e1fd5aaaeb6cee07a306fbdcd09d867a.png)

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 11, 2021, 1:45pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/4 "2021-03-11T13:45:09Z")

</div>

Please use the [get mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/indices-get-mapping.html) to retrieve the full mapping.

---

<div class="post-metadata">

### Author: ![HS161148](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@HS161148](https://discuss.elastic.co/u/HS161148)
#### Post date: [March 11, 2021, 1:54pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/5 "2021-03-11T13:54:01Z")

</div>

{"events\_2021\_2":{"mappings":{"event":{"\_all":{"enabled":false},"dynamic\_templates":[{"event\_string\_fields":{"match":"\*","mapping":{"analyzer":"event\_custom\_field\_search\_analyzer","fields":{"keyword\_value":{"ignore\_above":10922,"type":"keyword","doc\_values":true}},"index\_options":"docs","norms":{"enabled":false},"type":"text"}}}],"properties":{"acl type":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"action type":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"alert rule names":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"alert\_rule\_description":{"type":"text"},"application type":{"type":"text","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attribute name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attribute new value":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attribute old value":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attributechanges":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attributename":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attributenewvalue":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"attributeoldvalue":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"authentication":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"bam id":{"type":"long"},"bam name":{"type":"text","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"bam type id":{"type":"long"},"changedpermissions":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"classification category":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"creation\_timestamp":{"type":"date"},"customaction":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"destinationfileextension":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"destinationrelativeurl":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"domain":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"eventdata":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"eventinfo":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"extradetails":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"file extension":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"gpolinktoou":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"gponame":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"gpopropertyorigin":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"gpopropertypath":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"group name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"ip address":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"itemtype":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"linkexpirationdate":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"logical bam ids":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"logical paths":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"membername":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"modifiedobject":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"modifiedproperties":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"new name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"new path":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"newobjectcn":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"newobjectdn":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"object class":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"object name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"objectcn":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"objecttype":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"old name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"old path":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"originating server":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"path":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permission inheritance":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permission subject":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permission type":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permissionaction":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permissiongroup":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permissionname":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"permissionuser":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"siteid":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"snapshotdirectory":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"sourcerelativeurl":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"subjecttype":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"target entity":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"target entity type":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"threshold\_alert\_rule\_candidates":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"threshold\_alert\_rule\_ids":{"type":"long"},"time of day":{"type":"date","format":"epoch\_millis"},"timestamp":{"type":"date"},"user full name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"user name":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"useragent":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"usersharedwith":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"},"wssuserid":{"type":"text","norms":false,"index\_options":"docs","fields":{"keyword\_value":{"type":"keyword","ignore\_above":10922}},"analyzer":"event\_custom\_field\_search\_analyzer"}}}}}}

---

<div class="post-metadata">

### Author: ![HS161148](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@HS161148](https://discuss.elastic.co/u/HS161148)
#### Post date: [March 29, 2021, 2:43pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/6 "2021-03-29T14:43:00Z")

</div>

Hi Team,

Does anyone knows how to achieve this?

---

<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: [March 29, 2021, 3:05pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/7 "2021-03-29T15:05:19Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<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: [March 29, 2021, 3:05pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/8 "2021-03-29T15:05:31Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<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: [March 29, 2021, 3:06pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/9 "2021-03-29T15:06:19Z")

</div>

> [@HS161148](#):
>
> **How to fetch all documents that** [...]

You can use:

- the [`size` and `from` parameters](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html) to display by default up to 10000 records to your users. If you want to change this limit, you can change `index.max_result_window` setting but be aware of the consequences (ie memory).
- the [search after](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-after.html) feature to do deep pagination.
- the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html) if you want to extract a resultset to be consumed by another tool later.

---

<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: [March 29, 2021, 3:06pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/10 "2021-03-29T15:06:59Z")

</div>

5.1.1 is not supported anymore. Please upgrade. 7.12.0 is now available.

---

<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: [April 26, 2021, 3:07pm UTC](https://discuss.elastic.co/t/elastic-search-5-1-1-how-to-fetch-all-documents-that-contains-startswith-operator-on-a-field-in-elasticsearch/266945/11 "2021-04-26T15:07:20Z")

</div>

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