Dynamic value or a variable doesn't work inside a elasticsearch "range" query.
For explaining more this is a elasticsearch range query which find productId from 1000 to 11100, which is working perfectly ---
$json = '{
"query" : {
"range" : {
"productId" : {
"from" : '1000',
"to" : '11100'
}
}
}
}';
On the other hand using the same query with a variable with the same value it returns me error like ---
{"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures
$a =1000;
$b = 11100;
$json = '{
"query" : {
"range" : {
"productId" : {
"from" : '$a',
"to" : '$b'
}
}
}
}';
Do anyone knows where i am making the mistake.
Any suggestion will be great help. Thanks in advanced.