title: Executing bitmask with elastics database query
body: <p>I would like to select data from an elastics database where the data it returns will be based on the (bitmap) evaluation of a number in the query. 
  Something like $x &amp; 32 == 32</p>
  
  <p>The query is as follows:</p>
  
  <pre><code>{
    "size":1000,
    "sort": {
      "timestamp": "desc"
    },
    "fields" : ["id","timestamp", "eval_id"],
    "query": {
      "bool": {
        "must": [
          {
            "term": {
              "id": "450"
            }
          },
          {
            "term": {"eval_id": "161"}
          },
          {
                "range": {
                  "timestamp": {
                    "gte": 1427061600000,
                    "lte": 1427147999000
                  }
                }
              }
        ]
      }
    }
  }
  </code></pre>
  
  <p>So the "eval_id" must pass a bitmap evaluation in order to be returned by the JSON result.</p>
  
  <p>So eval_id can be 161 or 681 or 421 and so on..</p>
  
  <p>In SQL it looks like this: SUM(If ((eval_id &amp; 1 = 1), 1,0)) as 'EVAL_value'</p>
  
  <p>Can anyone help?</p>