Bitwise operations in elasticsearch without script?

(Arivazhagan Jeganathan) #1

I am using elasticsearch 1.5.1. I want to perform bit wise operations on my documents in elasticsearch.

Bitwise equivalent in elasticsearch as in SQL:

I do not want to use any scripting languages as it is not preferred. can some one provide some example on performing bit wise operations?

I tried looking out for various examples in internet but could not find any sample code /query in elasticsearch.

(Nik Everett) #2

I don't believe there is a way to do generic bitwise stuff without scripts. On the other hand, depending on what you want to do you rewrite it to a range query or a bool query with multiple range queries in the should clause. That is likely to be more efficient in some cases than a script because it can use the terms dictionary instead of doc values.

Its likely possible for you to implement more queries to do bitwise stuff against the terms dictionary in a plugin but that is a reasonably involved project all on its own. If you want to learn and you desperately need the speed its something you can think about.

(system) #3