Filter or sort hits to get one with special flag

I have a query like this.

{
  "size" : 0,
  "query" : {
    "constant_score" : {
      "filter" : {
        "bool" : {
          "must" : [
            {
              "term" : {
                "field1" : {
                  "value" : "value1",
                  "boost" : 1.0
                }
              }
            },
            {
            	//... some other filters
            }
          ]
        }
      },
      "boost" : 1.0
    }
  },
  "aggregations" : {
    "field2-agg" : {
      "sum" : {
        "field" : "field2"
      }
    }
  }
}

I want to also obtain single element with field3 = true.
One way to do this is to make a bulk request with 2 requests: this and a copy of this with additional must closure and size 1. But this would result in executing the same query twice.
Another way is to add a top_hits aggregation with custom sorting by field4. But sorting is expensive.

Which variant would be executed faster? Is there more elegant way to do this?

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