# Range query for Nested Documents for Keyword Type

**URL:** <https://discuss.elastic.co/t/range-query-for-nested-documents-for-keyword-type/230929>\
**Category:** Elasticsearch\
**Created:** [May 4, 2020, 6:37am UTC](https://discuss.elastic.co/t/range-query-for-nested-documents-for-keyword-type/230929 "2020-05-04T06:37:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thilak](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Thilak](https://discuss.elastic.co/u/Thilak)\
**Post date:** [May 4, 2020, 6:37am UTC](https://discuss.elastic.co/t/range-query-for-nested-documents-for-keyword-type/230929/1 "2020-05-04T06:37:05Z")

</div>

Hello

I have a document structure like this. For this below two documents, we have nested documents called interaction info. I just need to get only the documents that have title **duration** and their value is greater than **60**

Here whats the catch the value field is keyword not an integer. I know that only for the Integer Range query will get executed. Is there any possible way to find the documents that has duration greater than 60 ( Painless Query or Script Query )

```auto
{
    "key": "f07ff9ba-36e4-482a-9c1c-d888e89f926e",
    "interactionInfo": [
      {
        "title": "duration",
        "value": "11"
      },
      {
        "title": "timetaken",
        "value": "9"
      },
      {
        "title": "talk_time",
        "value": "145"
      }
    ]
  },
  {
    "key": "f07ff9ba-36e4-482a-9c1c-d888e89f926e",
    "interactionInfo": [
      {
        "title": "duration",
        "value": "120"
      },
      {
        "title": "timetaken",
        "value": "9"
      },
      {
        "title": "talk_time",
        "value": "60"
      }
    ]
  }

```

---

<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:** [June 1, 2020, 6:51am UTC](https://discuss.elastic.co/t/range-query-for-nested-documents-for-keyword-type/230929/2 "2020-06-01T06:51:00Z")

</div>

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