# Writing DSL Query to find documents for dyanmic fields in the index

**URL:** <https://forum.opensearch.org/t/writing-dsl-query-to-find-documents-for-dyanmic-fields-in-the-index/6539>\
**Category:** Open Source Elasticsearch and Kibana\
**Created:** [July 18, 2021, 9:56am UTC](https://forum.opensearch.org/t/writing-dsl-query-to-find-documents-for-dyanmic-fields-in-the-index/6539 "2021-07-18T09:56:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![divyank](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@divyank](https://forum.opensearch.org/u/divyank)\
**Post date:** [July 18, 2021, 9:56am UTC](https://forum.opensearch.org/t/writing-dsl-query-to-find-documents-for-dyanmic-fields-in-the-index/6539/1 "2021-07-18T09:56:26Z")

</div>

Hi All,  
I want to write a DSL Query that will fetch results from fields.

```auto
GET condition/_search
{
    "query": {
        "range" : {
            "tag.value" : {
                "gte" : "operational.threshold",
                 "lte" : "threshold.caution",
                "boost" : 2.0
            }
        }
    }
}

```

As I write the above code, it’s throwing an error of number format exception.  
Is there any way to find integer values using fields instead of integers in the code? As the field threshold.operational and threshold.caution dynamic fields means integer values will change with respect to time so I cannot use static integer values.  
Values I am comparing in code are as below-

```auto
tag.value
5.7
	
threshold.caution
5.5
	
threshold.operational
0.5
	
threshold.warning
11.2

```

![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/9/9df2a73ab35944232705af32fb82b928598d511b.png)

Output error pic attached.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/c/ce2f4ba082b321d1d0f3448bea9e0829241a741f.png)

---

<div class="post-metadata">

**Author:** ![kris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/kris/32/2208_2.png) [@kris](https://forum.opensearch.org/u/kris)\
**Post date:** [February 7, 2023, 12:03am UTC](https://forum.opensearch.org/t/writing-dsl-query-to-find-documents-for-dyanmic-fields-in-the-index/6539/2 "2023-02-07T00:03:12Z")

</div>

Closed on February 7, 2023, 12:03am UTC


