# Range query and pagination

**URL:** <https://discuss.elastic.co/t/range-query-and-pagination/207254>\
**Category:** Elasticsearch\
**Created:** [November 10, 2019, 6:29pm UTC](https://discuss.elastic.co/t/range-query-and-pagination/207254 "2019-11-10T18:29:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anand1](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@anand1](https://discuss.elastic.co/u/anand1)\
**Post date:** [November 10, 2019, 6:29pm UTC](https://discuss.elastic.co/t/range-query-and-pagination/207254/1 "2019-11-10T18:29:35Z")

</div>

Hi team,

I have log index which contains product and modification date and its has around 10M documents with duplicates of products since the same products modified on different date. i have a requirement to create REST API to retrieve the documents that are modified during the specific time frame.

I am using the following query in my rest API . i am retrieving the all the documents which are modified in the given time frame by passing the pagination value.

The query returns the different product when i execute the same query on multiple time with same total with same time duration.

For example :  
I have executed the query in the first time. it return the 15K documents.  
In the second time its returns the different products but total is same.

```
GET Iog_index/_search
{
"from":0,  
"size": 200, 
  "query": {  
      "range": {
        "Timestamp": {
          "gte": "2019-11-06 10:00:00",
          "lte": "2019-11-07 13:00:00",
          "format": "yyyy-MM-dd HH:mm:ss"
        }
      }
  }
}

```

Mapping:

```
{
  "logIndex": {
    "mappings": {
      "logType": {
        "properties": {
          "Application": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword"
              }
            }
          },
          "modifiedBy": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword"
              }
            }
          },
          "product": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword"
              }
            }
          },
          "Timestamp": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss"
          }
        }
      }
    }
  }
}

```

Could you please help me out to resolve this issue.

---

<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:** [December 8, 2019, 6:39pm UTC](https://discuss.elastic.co/t/range-query-and-pagination/207254/2 "2019-12-08T18:39:16Z")

</div>

Closed on December 8, 2019, 6:39pm UTC

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