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

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

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-

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

image

Output error pic attached.

The gte and lte parameters must contain values and can not take field names. If you want to compare fields within a document I suspect you will need to use a scripted field.

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