[ES|QL] Fixes some problems with numeric control values (#213204)

## Summary

ES|QL doesnt have sometimes the ability to compare a numeric field with
a string when this string is a numeric value. For example:

```
FROM kibana_sample_data_logs | WHERE bytes > "6193"
```

This is going to fail, the value should be numeric to work as expected.
For this reason controls that have numeric values do not work correctly.
This PR is fixing this
This commit is contained in:
Stratoula Kalafateli 2025-03-06 08:02:21 +01:00 committed by GitHub
parent 04ee5fc4f3
commit bf84c2aadd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,9 @@ export function initializeESQLControlSelections(initialState: ESQLControlState)
// derive ESQL control variable from state.
const getEsqlVariable = () => ({
key: variableName$.value,
value: selectedOptions$.value[0],
value: isNaN(Number(selectedOptions$.value[0]))
? selectedOptions$.value[0]
: Number(selectedOptions$.value[0]),
type: variableType$.value,
});
const esqlVariable$ = new BehaviorSubject<ESQLControlVariable>(getEsqlVariable());