Count the number of document which contains either or both terms, and the term's values must be within a range

I want to count the number of document that

  1. has either or both term A and term B
  2. if term A or/and term B exist, the value is between a range.

I manage to write count for single term count as below and it returns correct count. However, how should I change it to include term "B" with an "OR" logic?

GET /propertyindex/_count
{
  "query": {
      "range": { 
        "A": {
          "gt": 1550160000, 
          "lte":1551369600}
      }
  }
}

A bool query with a should clause with 2 inner queries?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.