# Is a way : to take on acount missing value buckets with Rollup search

**URL:** https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772
**Category:** Elasticsearch
**Created:** [October 17, 2018, 7:57am UTC](https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772 "2018-10-17T07:57:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Rollup\_eval](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@Rollup\_eval](https://discuss.elastic.co/u/Rollup_eval)
#### Post date: [October 17, 2018, 7:57am UTC](https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772/1 "2018-10-17T07:57:51Z")

</div>

Hi,

I am using the Rollup plugin 6.3.2 with es.  
In my "source index", some field values may be null or missing.

Using elasticsearch request : on the "rollup index" there is no problem using

- "missing": " **missing**" in term aggregation like :

```auto
GET index_rollup/_search
{
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@timestamp.date_histogram.timestamp",
        "interval": "1d",
        "time_zone": "Etc/UTC",
        "min_doc_count": 1
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "data.client.terms.value",
            "size": 100,
            "order": {
              "1": "desc"
            },
            **"missing": " __missing__"**
          },
          "aggs": {
            "1": {
              "sum": {
                "field": "data.client.terms._count"
              }
            },
            "4": {
              "terms": {
                "field": "data.method.terms.value",
                "size": 97,
                "order": {
                  "1": "desc"
                },
                **"missing": " __missing__"**
              },
              "aggs": {
                "1": {
                  "sum": {
                    "field": "data.client.terms._count"
                  }
                }
          }
      }

```

................................

```auto
Result: 
  "aggregations": {
    "2": {
      "buckets": [
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "1": {
                  "value": 3082196
                },
                "4": {
                  "doc_count_error_upper_bound": 0,
                  "sum_other_doc_count": 0,
                  "buckets": [
                    {
                      "1": {
                        "value": 2252323
                      },
                      "5": {
                        "doc_count_error_upper_bound": 0,
                        "sum_other_doc_count": 0,
                        "buckets": [
                          {
                            "1": {
                              "value": 2252323
                            },
                            "6": {
                              "doc_count_error_upper_bound": 0,
                              "sum_other_doc_count": 0,
                              "buckets": [
                                {
                                  "1": {
                                    "value": 2252323
                                  },
                                  "7": {
                                    "doc_count_error_upper_bound": 0,
                                    "sum_other_doc_count": 0,
                                    "buckets": [
                                      {
                                        "1": {
                                          "value": 2252323
                                        },
                                        **"key": " __missing__",**
                                        "doc_count": 1
                                      }
                                    ]
                                  },
                                  **"key": " __missing__",**
                                  "doc_count": 1
                                }
                              ]
                            },
                            **"key": " __missing__",**
                            "doc_count": 1
                          }
                        ]
                      },
                      **"key": " __missing__",**
                      "doc_count": 1
                    }

```

................................................

But using Rollup Search : **"missing": "missing"** is correct at parsing level (no error), but at execution level :

- List item

buckets with missing or empty values are empty  
as with normal elasticsearch request they taken on account

```auto
GET index-rollup/_rollup_search
{
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@timestamp",
        "interval": "1d"
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "data.client.terms.value",
            "size": 100000000,
            "missing": " __missing__"
          },
          "aggs": {
             "1": {
              "sum": {
                "field": "data.payloadsize"
              }
            },
            "4": {
              "terms": {
                "field": "data.method",
                "size": 100000000,
                "missing": " __missing__"
              },
              "aggs": {
                "5": {
                  "terms": {
                    "field": "data.submethod",
                    "size": 1000000000,
                     "missing": " __missing__"
                  }
            }

```

...........................................

```auto

  "aggregations": {
    "2": {
      "meta": {},
      "buckets": [
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "4": {
                  "doc_count_error_upper_bound": 0,
                  "sum_other_doc_count": 0,
                  **"buckets": []**
                },
                "key": "POST",
                "doc_count": 791573
              }
            ]
          }

```

.......................

Is a way : to take on acount missing value buckets with Rollup search ?

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [October 22, 2018, 2:50pm UTC](https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772/2 "2018-10-22T14:50:47Z")

</div>

Sorry for the delay, this slipped through my inbox.

It may be possible to support `missing`, although I need to do some thinking about it. The `missing` functionality is a little tricky due to how it's implemented internally.

But regardless, we should not allow a "bad" request to run. E.g. either `missing` should be supported, or we should throw an exception saying it's unsupported at the moment. I'll open a ticket to address this point in a minute, thanks for raising it to my attention!

---

<div class="post-metadata">

### Author: ![Rollup\_eval](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@Rollup\_eval](https://discuss.elastic.co/u/Rollup_eval)
#### Post date: [November 5, 2018, 3:38pm UTC](https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772/3 "2018-11-05T15:38:54Z")

</div>

Hi,  
Thank's for your reply.

I have solved the problem with a template for my rollup index.  
I force the concerned fields to NULL value , like this:

{  
"index\_patterns": ["pfs\_pnsapi-rollup\*"],  
"settings": {  
"number\_of\_shards": 1  
},  
"mappings": {  
"\_doc": {  
"dynamic\_templates": [  
{  
"strings": {  
"match\_mapping\_type": "string",  
"mapping": {  
"type": "keyword"  
}  
}  
},  
{  
"date\_histograms": {  
"path\_match": "\*.date\_histogram.timestamp",  
"mapping": {  
"type": "date"  
}  
}  
}  
],  
"properties": {  
.............................  
"q\_client": {  
"properties": {  
"terms": {  
"properties": {  
"\_count": {  
"type": "long"  
},  
"value": {  
"type": "keyword",  
**"null\_value": "NULL"**  
}  
}  
}  
}  
},  
"q\_method": {  
"properties": {  
"terms": {  
"properties": {  
"\_count": {  
"type": "long"  
},  
"value": {  
"type": "keyword",  
**"null\_value": "NULL"**  
}  
}  
}  
}  
},  
....................................  
and it seems to be correct with the rollup\_search

---

<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: [December 3, 2018, 3:39pm UTC](https://discuss.elastic.co/t/is-a-way-to-take-on-acount-missing-value-buckets-with-rollup-search/152772/4 "2018-12-03T15:39:12Z")

</div>

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