Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lucene query where two fields will be compared

Tags:

lucene

grafana

I have an elasticsearch cluster. All documents in the cluster have the same index and type. Each document has two number fields -> field1 and field2.

I want to display all documents in Grafana, where value of field1 > value of field2.

Is there a query like:

document_type:test AND field1 > field2 ?
like image 685
CPA Avatar asked May 22 '26 14:05

CPA


1 Answers

As far as I'm aware there is no way to perform that sort of query using elasticsearch (lucene). It does support range queries, but not comparison between different fields in the document.

like image 182
AussieDan Avatar answered May 25 '26 07:05

AussieDan