# Elasticsearch aggregation with regexp

**URL:** https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845
**Category:** Elasticsearch
**Created:** [February 13, 2017, 7:57am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845 "2017-02-13T07:57:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ciprian1](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@ciprian1](https://discuss.elastic.co/u/ciprian1)
#### Post date: [February 13, 2017, 7:57am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845/1 "2017-02-13T07:57:16Z")

</div>

Hi,  
I have the following query:

curl [http://localhost:9200/](http://localhost:9200/)\<my\_index\>/\_search

with this body:

{  
"aggs" : {  
"host" : {  
"terms": {  
"field": "host",  
"include" : ".\*"  
}  
}  
}  
}

Mapping for the 'host' field is like this:

```
      "host" : {
        "index" : "not_analyzed",
        "type" : "string"
      }

```

The problem is, when issuing the query, I always get something that starts like this:

"aggregations": {  
"host": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 368

My question is: why there are some unmatched documents? As I've shown above, the regexp was: "include" : ".\*", meaning all. Am I missing anything?

Thank you!

Ciprian.

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [February 13, 2017, 9:52am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845/2 "2017-02-13T09:52:04Z")

</div>

> [@ciprian1](#):
>
> As I've shown above, the regexp was: "include" : ".\*", meaning all.

Don't supply an include clause - that would implicitly mean "all" and using a regex will only add performance overhead.

---

<div class="post-metadata">

### Author: ![ciprian1](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@ciprian1](https://discuss.elastic.co/u/ciprian1)
#### Post date: [February 13, 2017, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845/3 "2017-02-13T11:01:44Z")

</div>

Ok, thanks for the hint :)!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 13, 2017, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-with-regexp/74845/4 "2017-03-13T11:01:47Z")

</div>

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