# Not able to get any results on using bucket aggregations

**URL:** https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576
**Category:** Elasticsearch
**Created:** [January 26, 2020, 6:42pm UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576 "2020-01-26T18:42:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fenster25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fenster25/32/55546_2.png) [@fenster25](https://discuss.elastic.co/u/fenster25)
#### Post date: [January 26, 2020, 6:42pm UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576/1 "2020-01-26T18:42:18Z")

</div>

I have some PR data in my ES. This is how the documents are modelled

```
 {
          "Author" : "dheerajrav",
          "Date" : "2012-10-05T10:16:49Z",
          "Number" : 2554441,
          "IsMerged" : false,
          "MergedBy" : "",
          "Body" : ""
        },
        {
          "Author" : "dheerajrav",
          "Date" : "2012-10-05T09:11:35Z",
          "Number" : 2553883,
          "IsMerged" : false,
          "MergedBy" : "",
          "Body" : ""
        },
        {
          "Author" : "crodjer",
          "Date" : "2012-10-04T15:40:22Z",
          "Number" : 2544540,
          "IsMerged" : false,
          "MergedBy" : "",
          "Body" : ""
        },
        {
          "Author" : "crodjer",
          "Date" : "2012-10-04T07:52:20Z",
          "Number" : 2539410,
          "IsMerged" : false,
          "MergedBy" : "",
          "Body" : ""
        }
      .
      .
      .
      ]
    }

```

I am trying the following terms agg on my index but I get no results

```
curl -X GET "localhost:9200/newidx/_search?pretty" -H 'Content-Type: application/json' -d'               
{
"aggs" : {
    "contributors" : {
        "terms" : {
            "field" : "Author",
            "size" : 100
        }
    }
  }
}
'

```

The desired result would have been separate buckets for each PR author. This is the response

```
 "aggregations" : {
 "contributors" : {
  "doc_count_error_upper_bound" : 0,
  "sum_other_doc_count" : 0,
  "buckets" : []
   }
  }

```

Am I modeling my data wrong?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 26, 2020, 6:56pm UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576/2 "2020-01-26T18:56:22Z")

</div>

What is the mapping?

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

### Author: ![fenster25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fenster25/32/55546_2.png) [@fenster25](https://discuss.elastic.co/u/fenster25)
#### Post date: [January 26, 2020, 7:19pm UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576/3 "2020-01-26T19:19:52Z")

</div>

This is the mapping for my index

```
{
  "newidx" : {
   "mappings" : {
     "properties" : {
         "Stats" : {
          "properties" : {
           "Author" : {
             "type" : "text",
              "fields" : {
               "keyword" : {
                  "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "Body" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "Date" : {
          "type" : "date"
        },
        "IsMerged" : {
          "type" : "boolean"
        },
        "MergedBy" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "Number" : {
          "type" : "long"
           }
         }
       }
     }
    }
 }
}

```

I generate a json file in my code and index it to elasticsearch using elasticsearch\_loader, here is the command

`elasticsearch_loader --es-host 'localhost' --index org-skills --type incident json --lines processed.json`

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 27, 2020, 1:32am UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576/4 "2020-01-27T01:32:49Z")

</div>

Try to run the agg on Stats.Author.keyword.

Why do you index those inner objects all together instead of a document per object?

---

<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: [February 24, 2020, 4:08am UTC](https://discuss.elastic.co/t/not-able-to-get-any-results-on-using-bucket-aggregations/216576/6 "2020-02-24T04:08:35Z")

</div>

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