Regexp vs Include performance comparison

Hi everybody

I work on a project and I need to aggregate the results based on "created" and "labels" field.
I created following queries that both give the result as I expected. But I want to learn that which query runs more fast?

My first query:

{
  "size": 0,
  "aggs": {
    "HEATMAP": {
      "date_histogram": {
        "field": "created",
        "interval": "day"
      },
      "aggs": {
        "BEHAVIOUR_CHANGE": {
          "terms": {
            "field": "labels",
            "include": "behavior-change"
          }
        },
        "FIRST_OCCURRENCE": {
          "terms": {
            "field": "labels",
            "include": "first-occurrence"
          }
        }
      }
    }
  }
}

My second query:

{
  "size": 0,
  "aggs": {
    "HEATMAP": {
      "date_histogram": {
        "field": "created",
        "interval": "day"
      },
      "aggs": {
        "BEHAVIOUR_CHANGE": {
          "filter": {
            "regexp": {
              "labels": "behavior-change"
            }
          }
        },
        "FIRST_OCCURRENCE": {
          "filter": {
            "regexp": {
              "labels": "first-occurrence"
            }
          }
        }
      }
    }
  }
}

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