Bit arrays usage and filtering in Elasticsearch

I have a bit array. And I want to filter based on if certain bits are ON or OFF. Looking at the Elasticsearch 2.3 docs, I don't see anything about bitarrays.

But it seems I can use an Array of Booleans or a Binary field.

Example: Let's say I have 2 documents each with a bit array field. Doc1 has 011100 and Doc2 has 00001 in that field. And I want to filter by 011000 which in this case only gives Doc1.

Any ideas how to do this in Elasticsearch?

Thanks you.

Edit: Another idea:

If I turn the bit array into many Bool fields, then it works. The doc might look ugly but it works. Basically if the bit array is 32 bit, then I will have 32 bool fields. Is that the best way to implement this?


if you could change it to an array containing the bit-index which are set. That is 011100 would be[ 1 , 2 ,3 ] and then use a terms query to do an or or a must query for and

Example :

a) document with "111" put test/test/1 { "bit_position" : [ 1, 2, 3 ] } b) document with 010 put test/test/2 { "bit_position": [ 2 ] } c) or-ing with 101 post test/_search { "query": { "terms": { "bit_position": [ 1, 3 ] } } }


  • Is there any way the JSON comparison ignores the whole section misplaced?
  • Extracting Nodes from multiple xml files
  • Dictionary of nested lists to pandas DataFrame
  • Calculating distance between word/document vectors from a nested dictionary
  • Java code throws exception after adding Selenium-java-2.31.0 library in Maven
  • How to create variables with dynamic [incremental] names in Scala
  • Copy file, but error double free or corruption in C
  • Variable Length Arguments without using stdarg.h
  • Do we need to initialize an array in Java? [duplicate]
  • How to use three different keys e.g. (Ctrl Shift O) to open a form in vb.net?
  • What is this javascript code doing?
  • Invoke another constructor in the same class
  • Reading XML into Datatable gives incorrect DateTime when the time has Time Zone info
  • 'doc_del_count' bigger than 'doc_count' on CouchDB
  • c# winform DrawToBitmap offscreen
  • Backward compatibility of Python 3.5 for external modules
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Hibernate to update table schema
  • What and where is mdimport
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • Abort upload large uploads after reading headers
  • Retrieving value from sql ExecuteScalar()
  • Read text file and split every line in MSBuild
  • Fetching methods from BroadcastReceiver to update UI
  • C# - Serializing and deserializing static member
  • Get object from AWS S3 as a stream
  • Java applet as stand-alone Windows application?
  • Symfony2: How to get request parameter
  • How to make Safari send if-modified-since header?
  • How do you troubleshoot character encoding problems?
  • GridView Sorting works once only
  • How to pass list parameters for each object using Spring MVC?
  • KeystoneJS: Relationships in Admin UI not updating
  • WPF Applying a trigger on binding failure
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • How to get Windows thread pool to call class member function?
  • JaxB to read class hierarchy
  • Checking variable from a different class in C#