How to make a bitwise comparison with MVEL in Elasticsearch Script Filter

1.5k views Asked by At

I'm using bitwise stored information.

To deal with it in elasticsearchs Script Filter I have to use MVEL.

The MVEL Docs says to calculate bitwise the operators are the quite usual ones, so:

& -> Bitwise AND

| -> Bitwise OR

^ -> Bitwise XOR

If I try to calculate bitwise in elasticsearch using this operators elasticsearch fails with a

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures

The filter looks like this:

"query": {
  "filtered": {
     "query": {
        "match_all": {}
     },
     "filter": {
        "script": {
           "script": "doc['options'].value == doc['options'].value | 2"
        }
     }
  }}

The field 'options' is mapped as integer. A usual operation like plus instead of the pipe would run correct and calculate correct.

Where is my bug?

0

There are 0 answers