# Aggregation - Blank and date aggregation

**URL:** https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628
**Category:** Elasticsearch
**Created:** [January 14, 2015, 9:37am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628 "2015-01-14T09:37:58Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)
#### Post date: [January 14, 2015, 9:37am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/1 "2015-01-14T09:37:58Z")

</div>

Hi ,

Can some one help me on this ?

Does term aggregation counts on blank field values ?

Does term aggregation is enough for doing date aggregation ? Or there any  
specific aggregations we have ?All I need in date aggregation is to know  
different dates and its counts ?

Regards,  
Nagaraju

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/06a328c6-eead-473e-ac04-41bd04464cfc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/06a328c6-eead-473e-ac04-41bd04464cfc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [January 14, 2015, 11:10am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/2 "2015-01-14T11:10:42Z")

</div>

On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
wrote:

> Does term aggregation counts on blank field values ?

Yes, an empty value "" counts as a term. Note that you need the field to be  
not analyzed for it to work (or to use an analyzer that emits empty  
strings). Otherwise the standard analyzer would analyzer "" as an empty  
list of tokens, so a field value of "" would not actually count...

> Does term aggregation is enough for doing date aggregation ? Or there any  
> specific aggregations we have ?All I need in date aggregation is to know  
> different dates and its counts ?

A terms aggregation is enough, but a date\_histogram aggregation is  
generally more useful on dates as there are lots of unique values and it's  
often more useful to group them based on the year, month or day.

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)
#### Post date: [January 15, 2015, 3:43pm UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/3 "2015-01-15T15:43:36Z")

</div>

Hey Adrien ,Thank you.I have one more question on aggregating on dates .

We actually stored date time in a field called "createdDateTime" but I need  
only aggregates on date part of date time .

Any ideas ? Or sample code can help us ?

Regards  
Nagaraju  
908 517 6981

On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
[adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:

> On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> 
> > Does term aggregation counts on blank field values ?
> 
> Yes, an empty value "" counts as a term. Note that you need the field to  
> be not analyzed for it to work (or to use an analyzer that emits empty  
> strings). Otherwise the standard analyzer would analyzer "" as an empty  
> list of tokens, so a field value of "" would not actually count...
> 
> > Does term aggregation is enough for doing date aggregation ? Or there any  
> > specific aggregations we have ?All I need in date aggregation is to know  
> > different dates and its counts ?
> 
> A terms aggregation is enough, but a date\_histogram aggregation is  
> generally more useful on dates as there are lots of unique values and it's  
> often more useful to group them based on the year, month or day.
> 
> --  
> Adrien Grand
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [January 15, 2015, 5:38pm UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/4 "2015-01-15T17:38:31Z")

</div>

Then it means that you want to use a date\_histogram aggregation with  
interval=day. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Thu, Jan 15, 2015 at 4:43 PM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
wrote:

> Hey Adrien ,Thank you.I have one more question on aggregating on dates .
> 
> We actually stored date time in a field called "createdDateTime" but I  
> need only aggregates on date part of date time .
> 
> Any ideas ? Or sample code can help us ?
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
> [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> 
> > On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > 
> > > Does term aggregation counts on blank field values ?
> > 
> > Yes, an empty value "" counts as a term. Note that you need the field to  
> > be not analyzed for it to work (or to use an analyzer that emits empty  
> > strings). Otherwise the standard analyzer would analyzer "" as an empty  
> > list of tokens, so a field value of "" would not actually count...
> > 
> > > Does term aggregation is enough for doing date aggregation ? Or there  
> > > any specific aggregations we have ?All I need in date aggregation is to  
> > > know different dates and its counts ?
> > 
> > A terms aggregation is enough, but a date\_histogram aggregation is  
> > generally more useful on dates as there are lots of unique values and it's  
> > often more useful to group them based on the year, month or day.
> > 
> > --  
> > Adrien Grand
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)
#### Post date: [January 16, 2015, 8:23am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/5 "2015-01-16T08:23:57Z")

</div>

Hi ,

I tried but date histrogram didnt work not sure what is the mistake am doing

here is date histrogram request(json) am passing and also pasted sample doc  
structure

date histogram request

{  
"aggs": {  
"createddatetime": {  
"date\_histogram": {  
"field": "createddatetime",  
"interval": "day"  
}  
}  
}  
}

Document in index has fields

- 
  - "id": 79,
  - "rank": 0,
  - "dateSort2": "2015-01-15T06:08:06.7091884Z",
  - "dateSort3": "0001-01-01T00:00:00",
  - "doubleSort1": 118.5,
  - "doubleSort2": 67884.18,
  - "doubleSort3": 54262.600000000006,
  - "numField": 0,
  - "createdDateTime": "2015-01-16T06:08:06.7091884Z",
  - 

Regards  
Nagaraju  
908 517 6981

On Thu, Jan 15, 2015 at 12:38 PM, Adrien Grand \<  
[adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:

> Then it means that you want to use a date\_histogram aggregation with  
> interval=day. See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html)
> 
> On Thu, Jan 15, 2015 at 4:43 PM, buddarapu nagaraju \<[budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)
> 
> > wrote:
> 
> > Hey Adrien ,Thank you.I have one more question on aggregating on dates .
> > 
> > We actually stored date time in a field called "createdDateTime" but I  
> > need only aggregates on date part of date time .
> > 
> > Any ideas ? Or sample code can help us ?
> > 
> > Regards  
> > Nagaraju  
> > 908 517 6981
> > 
> > On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
> > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> > 
> > > On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > > 
> > > > Does term aggregation counts on blank field values ?
> > > 
> > > Yes, an empty value "" counts as a term. Note that you need the field to  
> > > be not analyzed for it to work (or to use an analyzer that emits empty  
> > > strings). Otherwise the standard analyzer would analyzer "" as an empty  
> > > list of tokens, so a field value of "" would not actually count...
> > > 
> > > > Does term aggregation is enough for doing date aggregation ? Or there  
> > > > any specific aggregations we have ?All I need in date aggregation is to  
> > > > know different dates and its counts ?
> > > 
> > > A terms aggregation is enough, but a date\_histogram aggregation is  
> > > generally more useful on dates as there are lots of unique values and it's  
> > > often more useful to group them based on the year, month or day.
> > > 
> > > --  
> > > Adrien Grand
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXJ-s14ZFCMi4RjFjePCpvW9-URP5T61hBCLHKbCU9o\_aA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXJ-s14ZFCMi4RjFjePCpvW9-URP5T61hBCLHKbCU9o_aA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)
#### Post date: [January 16, 2015, 8:41am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/6 "2015-01-16T08:41:24Z")

</div>

Index mapping here

"mappings": {

- "document": {
  - "properties": {
    - "createdDateTime": {
      - "format": "dateOptionalTime",
      - "type": "date"  
},

    - "doubleSort1": {
      - "type": "double"  
},

    - "stringSort3": {
      - "type": "string"  
},

    - "doubleSort2": {
      - "type": "double"  
},

    - "doubleSort3": {
      - "type": "double"  
},

    - "numSort1": {
      - "type": "long"  
},

    - "stringSort2": {
      - "type": "string"  
},

    - "dcn": {
      - "type": "string"  
},

    - "numSort2": {
      - "type": "long"  
},

    - "numSort3": {
      - "type": "long"  
},

    - "path": {
      - "type": "string"  
},

    - "numField": {
      - "type": "long"  
},

    - "dateSort3": {
      - "format": "dateOptionalTime",
      - "type": "date"  
},

    - "dateSort2": {
      - "format": "dateOptionalTime",
      - "type": "date"  
},

    - "rank": {
      - "type": "double"  
},

    - "id": {
      - "type": "long"  
},

    - "text": {
      - "type": "string"  
},

    - "fields": {
      - "properties": {
        - "isAnalyzed": {
          - "type": "boolean"  
},

        - "name": {
          - "type": "string"  
},

        - "isFullText": {
          - "type": "boolean"  
},

        - "isStored": {
          - "type": "boolean"  
},

        - "value": {
          - "type": "string"  
}  
}  
}  
}  
}

Regards  
Nagaraju  
908 517 6981

On Fri, Jan 16, 2015 at 3:23 AM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
wrote:

> Hi ,
> 
> I tried but date histrogram didnt work not sure what is the mistake am  
> doing
> 
> here is date histrogram request(json) am passing and also pasted sample  
> doc structure
> 
> date histogram request
> 
> {  
> "aggs": {  
> "createddatetime": {  
> "date\_histogram": {  
> "field": "createddatetime",  
> "interval": "day"  
> }  
> }  
> }  
> }
> 
> Document in index has fields
> 
> - 
> - "id": 79,
> - "rank": 0,
> - "dateSort2": "2015-01-15T06:08:06.7091884Z",
> - "dateSort3": "0001-01-01T00:00:00",
> - "doubleSort1": 118.5,
> - "doubleSort2": 67884.18,
> - "doubleSort3": 54262.600000000006,
> - "numField": 0,
> - "createdDateTime": "2015-01-16T06:08:06.7091884Z",
> - 
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> On Thu, Jan 15, 2015 at 12:38 PM, Adrien Grand \<  
> [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> 
> > Then it means that you want to use a date\_histogram aggregation with  
> > interval=day. See  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html)
> > 
> > On Thu, Jan 15, 2015 at 4:43 PM, buddarapu nagaraju \<  
> > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > 
> > > Hey Adrien ,Thank you.I have one more question on aggregating on dates .
> > > 
> > > We actually stored date time in a field called "createdDateTime" but I  
> > > need only aggregates on date part of date time .
> > > 
> > > Any ideas ? Or sample code can help us ?
> > > 
> > > Regards  
> > > Nagaraju  
> > > 908 517 6981
> > > 
> > > On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
> > > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> > > 
> > > > On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> > > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > > > 
> > > > > Does term aggregation counts on blank field values ?
> > > > 
> > > > Yes, an empty value "" counts as a term. Note that you need the field  
> > > > to be not analyzed for it to work (or to use an analyzer that emits empty  
> > > > strings). Otherwise the standard analyzer would analyzer "" as an empty  
> > > > list of tokens, so a field value of "" would not actually count...
> > > > 
> > > > > Does term aggregation is enough for doing date aggregation ? Or there  
> > > > > any specific aggregations we have ?All I need in date aggregation is to  
> > > > > know different dates and its counts ?
> > > > 
> > > > A terms aggregation is enough, but a date\_histogram aggregation is  
> > > > generally more useful on dates as there are lots of unique values and it's  
> > > > often more useful to group them based on the year, month or day.
> > > > 
> > > > --  
> > > > Adrien Grand
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Adrien Grand
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [January 16, 2015, 8:54am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/7 "2015-01-16T08:54:06Z")

</div>

This looks good, what error did you get?

On Fri, Jan 16, 2015 at 9:41 AM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
wrote:

> Index mapping here
> 
> "mappings": {
> 
> - "document": {
> - "properties": {
> - "createdDateTime": {
> - "format": "dateOptionalTime",
> - "type": "date"  
> },
> 
> - "doubleSort1": {
> - "type": "double"  
> },
> 
> - "stringSort3": {
> - "type": "string"  
> },
> 
> - "doubleSort2": {
> - "type": "double"  
> },
> 
> - "doubleSort3": {
> - "type": "double"  
> },
> 
> - "numSort1": {
> - "type": "long"  
> },
> 
> - "stringSort2": {
> - "type": "string"  
> },
> 
> - "dcn": {
> - "type": "string"  
> },
> 
> - "numSort2": {
> - "type": "long"  
> },
> 
> - "numSort3": {
> - "type": "long"  
> },
> 
> - "path": {
> - "type": "string"  
> },
> 
> - "numField": {
> - "type": "long"  
> },
> 
> - "dateSort3": {
> - "format": "dateOptionalTime",
> - "type": "date"  
> },
> 
> - "dateSort2": {
> - "format": "dateOptionalTime",
> - "type": "date"  
> },
> 
> - "rank": {
> - "type": "double"  
> },
> 
> - "id": {
> - "type": "long"  
> },
> 
> - "text": {
> - "type": "string"  
> },
> 
> - "fields": {
> - "properties": {
> - "isAnalyzed": {
> - "type": "boolean"  
> },
> 
> - "name": {
> - "type": "string"  
> },
> 
> - "isFullText": {
> - "type": "boolean"  
> },
> 
> - "isStored": {
> - "type": "boolean"  
> },
> 
> - "value": {
> - "type": "string"  
> }  
> }  
> }  
> }  
> }
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> On Fri, Jan 16, 2015 at 3:23 AM, buddarapu nagaraju \<[budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)
> 
> > wrote:
> 
> > Hi ,
> > 
> > I tried but date histrogram didnt work not sure what is the mistake am  
> > doing
> > 
> > here is date histrogram request(json) am passing and also pasted sample  
> > doc structure
> > 
> > date histogram request
> > 
> > {  
> > "aggs": {  
> > "createddatetime": {  
> > "date\_histogram": {  
> > "field": "createddatetime",  
> > "interval": "day"  
> > }  
> > }  
> > }  
> > }
> > 
> > Document in index has fields
> > 
> > - 
> > - "id": 79,
> > - "rank": 0,
> > - "dateSort2": "2015-01-15T06:08:06.7091884Z",
> > - "dateSort3": "0001-01-01T00:00:00",
> > - "doubleSort1": 118.5,
> > - "doubleSort2": 67884.18,
> > - "doubleSort3": 54262.600000000006,
> > - "numField": 0,
> > - "createdDateTime": "2015-01-16T06:08:06.7091884Z",
> > - 
> > 
> > Regards  
> > Nagaraju  
> > 908 517 6981
> > 
> > On Thu, Jan 15, 2015 at 12:38 PM, Adrien Grand \<  
> > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> > 
> > > Then it means that you want to use a date\_histogram aggregation with  
> > > interval=day. See  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html)
> > > 
> > > On Thu, Jan 15, 2015 at 4:43 PM, buddarapu nagaraju \<  
> > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > > 
> > > > Hey Adrien ,Thank you.I have one more question on aggregating on dates .
> > > > 
> > > > We actually stored date time in a field called "createdDateTime" but I  
> > > > need only aggregates on date part of date time .
> > > > 
> > > > Any ideas ? Or sample code can help us ?
> > > > 
> > > > Regards  
> > > > Nagaraju  
> > > > 908 517 6981
> > > > 
> > > > On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
> > > > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:
> > > > 
> > > > > On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> > > > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)\> wrote:
> > > > > 
> > > > > > Does term aggregation counts on blank field values ?
> > > > > 
> > > > > Yes, an empty value "" counts as a term. Note that you need the field  
> > > > > to be not analyzed for it to work (or to use an analyzer that emits empty  
> > > > > strings). Otherwise the standard analyzer would analyzer "" as an empty  
> > > > > list of tokens, so a field value of "" would not actually count...
> > > > > 
> > > > > > Does term aggregation is enough for doing date aggregation ? Or there  
> > > > > > any specific aggregations we have ?All I need in date aggregation is to  
> > > > > > know different dates and its counts ?
> > > > > 
> > > > > A terms aggregation is enough, but a date\_histogram aggregation is  
> > > > > generally more useful on dates as there are lots of unique values and it's  
> > > > > often more useful to group them based on the year, month or day.
> > > > > 
> > > > > --  
> > > > > Adrien Grand
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Adrien Grand
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o\_8\_Riu9\_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o_8_Riu9_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)
#### Post date: [January 16, 2015, 9:50am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/8 "2015-01-16T09:50:13Z")

</div>

I was able to figure out through fiddler ...date histrograms are returns in  
seperate nested object in the result .. Now works

On Friday, January 16, 2015, Adrien Grand [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)  
wrote:

> This looks good, what error did you get?
> 
> On Fri, Jan 16, 2015 at 9:41 AM, buddarapu nagaraju \<[budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
> \<javascript:\_e(%7B%7D,'cvml','budda08nitt@gmail.com');\>\> wrote:
> 
> > Index mapping here
> > 
> > "mappings": {
> > 
> > - "document": {
> > - "properties": {
> > - "createdDateTime": {
> > - "format": "dateOptionalTime",
> > - "type": "date"  
> > },
> > 
> > - "doubleSort1": {
> > - "type": "double"  
> > },
> > 
> > - "stringSort3": {
> > - "type": "string"  
> > },
> > 
> > - "doubleSort2": {
> > - "type": "double"  
> > },
> > 
> > - "doubleSort3": {
> > - "type": "double"  
> > },
> > 
> > - "numSort1": {
> > - "type": "long"  
> > },
> > 
> > - "stringSort2": {
> > - "type": "string"  
> > },
> > 
> > - "dcn": {
> > - "type": "string"  
> > },
> > 
> > - "numSort2": {
> > - "type": "long"  
> > },
> > 
> > - "numSort3": {
> > - "type": "long"  
> > },
> > 
> > - "path": {
> > - "type": "string"  
> > },
> > 
> > - "numField": {
> > - "type": "long"  
> > },
> > 
> > - "dateSort3": {
> > - "format": "dateOptionalTime",
> > - "type": "date"  
> > },
> > 
> > - "dateSort2": {
> > - "format": "dateOptionalTime",
> > - "type": "date"  
> > },
> > 
> > - "rank": {
> > - "type": "double"  
> > },
> > 
> > - "id": {
> > - "type": "long"  
> > },
> > 
> > - "text": {
> > - "type": "string"  
> > },
> > 
> > - "fields": {
> > - "properties": {
> > - "isAnalyzed": {
> > - "type": "boolean"  
> > },
> > 
> > - "name": {
> > - "type": "string"  
> > },
> > 
> > - "isFullText": {
> > - "type": "boolean"  
> > },
> > 
> > - "isStored": {
> > - "type": "boolean"  
> > },
> > 
> > - "value": {
> > - "type": "string"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > Regards  
> > Nagaraju  
> > 908 517 6981
> > 
> > On Fri, Jan 16, 2015 at 3:23 AM, buddarapu nagaraju \<  
> > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
> > \<javascript:\_e(%7B%7D,'cvml','budda08nitt@gmail.com');\>\> wrote:
> > 
> > > Hi ,
> > > 
> > > I tried but date histrogram didnt work not sure what is the mistake am  
> > > doing
> > > 
> > > here is date histrogram request(json) am passing and also pasted sample  
> > > doc structure
> > > 
> > > date histogram request
> > > 
> > > {  
> > > "aggs": {  
> > > "createddatetime": {  
> > > "date\_histogram": {  
> > > "field": "createddatetime",  
> > > "interval": "day"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Document in index has fields
> > > 
> > > - 
> > > - "id": 79,
> > > - "rank": 0,
> > > - "dateSort2": "2015-01-15T06:08:06.7091884Z",
> > > - "dateSort3": "0001-01-01T00:00:00",
> > > - "doubleSort1": 118.5,
> > > - "doubleSort2": 67884.18,
> > > - "doubleSort3": 54262.600000000006,
> > > - "numField": 0,
> > > - "createdDateTime": "2015-01-16T06:08:06.7091884Z",
> > > - 
> > > 
> > > Regards  
> > > Nagaraju  
> > > 908 517 6981
> > > 
> > > On Thu, Jan 15, 2015 at 12:38 PM, Adrien Grand \<  
> > > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)  
> > > \<javascript:\_e(%7B%7D,'cvml','adrien.grand@elasticsearch.com');\>\> wrote:
> > > 
> > > > Then it means that you want to use a date\_histogram aggregation with  
> > > > interval=day. See  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html)
> > > > 
> > > > On Thu, Jan 15, 2015 at 4:43 PM, buddarapu nagaraju \<  
> > > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
> > > > \<javascript:\_e(%7B%7D,'cvml','budda08nitt@gmail.com');\>\> wrote:
> > > > 
> > > > > Hey Adrien ,Thank you.I have one more question on aggregating on dates  
> > > > > .
> > > > > 
> > > > > We actually stored date time in a field called "createdDateTime" but I  
> > > > > need only aggregates on date part of date time .
> > > > > 
> > > > > Any ideas ? Or sample code can help us ?
> > > > > 
> > > > > Regards  
> > > > > Nagaraju  
> > > > > 908 517 6981
> > > > > 
> > > > > On Wed, Jan 14, 2015 at 6:10 AM, Adrien Grand \<  
> > > > > [adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)  
> > > > > \<javascript:\_e(%7B%7D,'cvml','adrien.grand@elasticsearch.com');\>\>  
> > > > > wrote:
> > > > > 
> > > > > > On Wed, Jan 14, 2015 at 10:37 AM, buddarapu nagaraju \<  
> > > > > > [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
> > > > > > \<javascript:\_e(%7B%7D,'cvml','budda08nitt@gmail.com');\>\> wrote:
> > > > > > 
> > > > > > > Does term aggregation counts on blank field values ?
> > > > > > 
> > > > > > Yes, an empty value "" counts as a term. Note that you need the field  
> > > > > > to be not analyzed for it to work (or to use an analyzer that emits empty  
> > > > > > strings). Otherwise the standard analyzer would analyzer "" as an empty  
> > > > > > list of tokens, so a field value of "" would not actually count...
> > > > > > 
> > > > > > > Does term aggregation is enough for doing date aggregation ? Or  
> > > > > > > there any specific aggregations we have ?All I need in date aggregation is  
> > > > > > > to know different dates and its counts ?
> > > > > > 
> > > > > > A terms aggregation is enough, but a date\_histogram aggregation is  
> > > > > > generally more useful on dates as there are lots of unique values and it's  
> > > > > > often more useful to group them based on the year, month or day.
> > > > > > 
> > > > > > --  
> > > > > > Adrien Grand
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > > > > > \<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> > > > > > .  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j74ZqbBN0zNW6-5Feu7xYTKkomzx%3DDMhx28inFVYLSu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > > > > \<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> > > > > .  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN\_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKp0JycJfNvLxPGN_5YL7P-X%3DGDzvmYJQ9NFN7Q%2BaJjQw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Adrien Grand
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > > > \<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> > > > .  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7Nn8h7C9BoW6PUjHbS%2Bnerpw3%3DWUi5RrC5ewtDBtSRaA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > \<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> > .  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXL1FnbPHGfE3h5WmYuyYWpRCJmG%2B0167av24Y%3Dc200u3g%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/i9N09n\_-n38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/i9N09n_-n38/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> \<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> .  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o\_8\_Riu9\_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o_8_Riu9_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o\_8\_Riu9\_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j59V6o_8_Riu9_Vo6g-YsmPM71uUMt1%3DQBWVjHm-Jq5VQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards  
Nagaraju  
908 517 6981

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKmxEKpPZ22uFexnWKVrNmTz7vsOoo3wMGbTCN%3DAOo%3DDw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXXKmxEKpPZ22uFexnWKVrNmTz7vsOoo3wMGbTCN%3DAOo%3DDw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 12:38am UTC](https://discuss.elastic.co/t/aggregation-blank-and-date-aggregation/21628/9 "2017-07-06T00:38:27Z")

</div>


