# Search\_query

**URL:** https://discuss.elastic.co/t/search-query/4682
**Category:** Elasticsearch
**Created:** [June 22, 2011, 8:39am UTC](https://discuss.elastic.co/t/search-query/4682 "2011-06-22T08:39:19Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 22, 2011, 8:39am UTC](https://discuss.elastic.co/t/search-query/4682/1 "2011-06-22T08:39:19Z")

</div>

Hi!  
if anybody have been used groupby query in elastic search.Please reply  
me.

```
                                                Your Thankfully

                                              Sandeep Kumar Tiwari
```

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [June 22, 2011, 9:09am UTC](https://discuss.elastic.co/t/search-query/4682/2 "2011-06-22T09:09:33Z")

</div>

Hi,

can you be more specific? May be you want to look at parent/child feature.

Regards,  
Lukas

On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:

> Hi!  
> if anybody have been used groupby query in Elasticsearch.Please reply  
> me.
> 
> ```
> Your Thankfully
> 
> Sandeep Kumar Tiwari
> 
> ```

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 22, 2011, 9:13am UTC](https://discuss.elastic.co/t/search-query/4682/3 "2011-06-22T09:13:30Z")

</div>

Sir!  
I want to know how use group by date in my Elasticsearch query.

On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> Hi,
> 
> can you be more specific? May be you want to look at parent/child feature.
> 
> Regards,  
> Lukas
> 
> On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:
> 
> > Hi!  
> > if anybody have been used groupby query in Elasticsearch.Please  
> > reply me.
> > 
> > ```
> > Your Thankfully
> > 
> > Sandeep Kumar Tiwari
> > 
> > ```

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [June 22, 2011, 9:32am UTC](https://discuss.elastic.co/t/search-query/4682/4 "2011-06-22T09:32:48Z")

</div>

Hi,

can you give some example of the output you want to get from the search  
engine?

Regards,  
Lukas

On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:

> Sir!  
> I want to know how use group by date in my Elasticsearch query.
> 
> On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> 
> > Hi,
> > 
> > can you be more specific? May be you want to look at parent/child feature.
> > 
> > Regards,  
> > Lukas
> > 
> > On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:
> > 
> > > Hi!  
> > > if anybody have been used groupby query in Elasticsearch.Please  
> > > reply me.
> > > 
> > > ```
> > > Your Thankfully
> > > 
> > > Sandeep Kumar Tiwari
> > > 
> > > ```

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 22, 2011, 12:42pm UTC](https://discuss.elastic.co/t/search-query/4682/5 "2011-06-22T12:42:14Z")

</div>

Sir!  
Result should be date wise search of group.  
example-  
22/06/2011  
  
positive-1000  
Negative-500  
Neutral-200  
23/06/2011  
  
positive-1000  
Negative-500  
Neutral-200  
etc........  
please help me sir!  
thanks!

On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> Hi,
> 
> can you give some example of the output you want to get from the search  
> engine?
> 
> Regards,  
> Lukas
> 
> On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:
> 
> > Sir!  
> > I want to know how use group by date in my Elasticsearch query.
> > 
> > On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> > 
> > > Hi,
> > > 
> > > can you be more specific? May be you want to look at parent/child  
> > > feature.
> > > 
> > > Regards,  
> > > Lukas
> > > 
> > > On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari \<[sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)
> > > 
> > > > wrote:
> > > 
> > > > Hi!  
> > > > if anybody have been used groupby query in Elasticsearch.Please  
> > > > reply me.
> > > > 
> > > > ```
> > > > Your Thankfully
> > > > 
> > > > Sandeep Kumar Tiwari
> > > > 
> > > > ```

---

<div class="post-metadata">

### Author: ![IvanBrusic](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@IvanBrusic](https://discuss.elastic.co/u/IvanBrusic)
#### Post date: [June 22, 2011, 6:09pm UTC](https://discuss.elastic.co/t/search-query/4682/6 "2011-06-22T18:09:57Z")

</div>

In SQL, GROUP BY allows you to use aggregate functions on your date  
such as count (in your example), max, min, etc... In Elasticsearch,  
facets allow you to do similar aggregations.

> **[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.

Is your example the output of a query? If polarity\_count is the term  
to group by, you can use it as a facet, and use facet filters for each  
of the cases (positive, negative, neutral).

Cheers,

Ivan

On Jun 22, 8:42 am, sandeep tiwari [sandeep15...@gmail.com](mailto:sandeep15...@gmail.com) wrote:

> Sir!  
> Result should be date wise search of group.  
> example-  
> 22/06/2011  
>   
> positive-1000  
> Negative-500  
> Neutral-200  
> 23/06/2011  
>   
> positive-1000  
> Negative-500  
> Neutral-200  
> etc........  
> please help me sir!  
> thanks!
> 
> On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:
> 
> > Hi,
> 
> > can you give some example of the output you want to get from the search  
> > engine?
> 
> > Regards,  
> > Lukas
> 
> > On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari [sandeep15...@gmail.com](mailto:sandeep15...@gmail.com)wrote:
> 
> > > Sir!  
> > > I want to know how use group by date in my Elasticsearch query.
> 
> > > On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com)wrote:
> 
> > > > Hi,
> 
> > > > can you be more specific? May be you want to look at parent/child  
> > > > feature.
> 
> > > > Regards,  
> > > > Lukas
> 
> > > > On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari \<[sandeep15...@gmail.com](mailto:sandeep15...@gmail.com)
> > > > 
> > > > > wrote:
> 
> > > > > Hi!  
> > > > > if anybody have been used groupby query in Elasticsearch.Please  
> > > > > reply me.
> 
> > > > > ```
> > > > > Your Thankfully
> > > > > 
> > > > > ```
> 
> > > > > ```
> > > > > Sandeep Kumar Tiwari
> > > > > 
> > > > > ```

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 23, 2011, 4:55am UTC](https://discuss.elastic.co/t/search-query/4682/7 "2011-06-23T04:55:41Z")

</div>

Sir!  
please give me one example.  
thanks!

On Wed, Jun 22, 2011 at 11:39 PM, Ivan Brusic [ivan\_brusic@yahoo.com](mailto:ivan_brusic@yahoo.com) wrote:

> In SQL, GROUP BY allows you to use aggregate functions on your date  
> such as count (in your example), max, min, etc... In Elasticsearch,  
> facets allow you to do similar aggregations.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/)
> 
> Is your example the output of a query? If polarity\_count is the term  
> to group by, you can use it as a facet, and use facet filters for each  
> of the cases (positive, negative, neutral).
> 
> Cheers,
> 
> Ivan
> 
> On Jun 22, 8:42 am, sandeep tiwari [sandeep15...@gmail.com](mailto:sandeep15...@gmail.com) wrote:
> 
> > Sir!  
> > Result should be date wise search of group.  
> > example-  
> > 22/06/2011  
> >   
> > positive-1000  
> > Negative-500  
> > Neutral-200  
> > 23/06/2011  
> >   
> > positive-1000  
> > Negative-500  
> > Neutral-200  
> > etc........  
> > please help me sir!  
> > thanks!
> > 
> > On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com)  
> > wrote:
> > 
> > > Hi,
> > 
> > > can you give some example of the output you want to get from the search  
> > > engine?
> > 
> > > Regards,  
> > > Lukas
> > 
> > > On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari \<  
> > > [sandeep15...@gmail.com](mailto:sandeep15...@gmail.com)\>wrote:
> > 
> > > > Sir!  
> > > > I want to know how use group by date in my Elasticsearch  
> > > > query.
> > 
> > > > On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček \<[lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com)  
> > > > wrote:
> > 
> > > > > Hi,
> > 
> > > > > can you be more specific? May be you want to look at parent/child  
> > > > > feature.
> > 
> > > > > Regards,  
> > > > > Lukas
> > 
> > > > > On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari \<  
> > > > > [sandeep15...@gmail.com](mailto:sandeep15...@gmail.com)
> > > > > 
> > > > > > wrote:
> > 
> > > > > > Hi!  
> > > > > > if anybody have been used groupby query in elastic  
> > > > > > search.Please  
> > > > > > reply me.
> > 
> > > > > > ```
> > > > > > Your
> > > > > > 
> > > > > > ```
> 
> Thankfully
> 
> > > > > > ```
> > > > > > Sandeep Kumar
> > > > > > 
> > > > > > ```
> 
> Tiwari

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 23, 2011, 8:37am UTC](https://discuss.elastic.co/t/search-query/4682/8 "2011-06-23T08:37:38Z")

</div>

On Thu, 2011-06-23 at 10:25 +0530, sandeep tiwari wrote:

> Sir!  
> please give me one example.  
> thanks!

Sandeep, Ivan has provided you with a link to the documents about  
facets, which include examples.

I suggest that you read the examples, plus as much of the docs as you  
need to to understand the basics of Elasticsearch, try out the examples,  
and if you're still having problems, come back with: "I tried XYZ, and  
I'm seeing error FOO. What am I doing wrong?".

That way we will be more able to help you.

Also, see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)

clint

> On Wed, Jun 22, 2011 at 11:39 PM, Ivan Brusic [ivan\_brusic@yahoo.com](mailto:ivan_brusic@yahoo.com)  
> wrote:  
> In SQL, GROUP BY allows you to use aggregate functions on your  
> date  
> such as count (in your example), max, min, etc... In  
> Elasticsearch,  
> facets allow you to do similar aggregations.
> 
> ```
> http://www.elasticsearch.org/guide/reference/api/search/facets/
>     
> Is your example the output of a query? If polarity_count is
> the term
> to group by, you can use it as a facet, and use facet filters
> for each
> of the cases (positive, negative, neutral).
>     
> Cheers,
>     
> Ivan
>     
> On Jun 22, 8:42 am, sandeep tiwari <sandeep15...@gmail.com>
> wrote:
> > Sir!
> > Result should be date wise search of group.
> > example-
> > 22/06/2011
> > <polarity count>
> > positive-1000
> > Negative-500
> > Neutral-200
> > 23/06/2011
> > <polarity count>
> > positive-1000
> > Negative-500
> > Neutral-200
> > etc........
> > please help me sir!
> > thanks!
> >
> >
> >
> >
> >
> >
> >
>     
> > On Wed, Jun 22, 2011 at 3:02 PM, LukÃ¡Å¡ VlÄek
> <lukas.vl...@gmail.com> wrote:
> > > Hi,
> >
> > > can you give some example of the output you want to get
> from the search
> > > engine?
> >
> > > Regards,
> > > Lukas
> >
>     
> > > On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari
> <sandeep15...@gmail.com>wrote:
> >
> > >> Sir!
> > >> I want to know how use group by date in my elastic
> search query.
> >
>     
> > >> On Wed, Jun 22, 2011 at 2:39 PM, LukÃ¡Å¡ VlÄek
> <lukas.vl...@gmail.com>wrote:
> >
> > >>> Hi,
> >
> > >>> can you be more specific? May be you want to look at
> parent/child
> > >>> feature.
> >
> > >>> Regards,
> > >>> Lukas
> >
>     
> > >>> On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari
> <sandeep15...@gmail.com
>     
> > >>> > wrote:
> >
> > >>>> Hi!
> > >>>> if anybody have been used groupby query in elastic
> search.Please
> > >>>> reply me.
> >
> > >>>>
> Your Thankfully
> >
> > >>>>
> Sandeep Kumar Tiwari
> 
> ```

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 23, 2011, 1:21pm UTC](https://discuss.elastic.co/t/search-query/4682/9 "2011-06-23T13:21:04Z")

</div>

\*Sir!  
\*  
\*  
\*  
\*  
\*  
\*I wnat to execute \*{

> > "query": {"match\_all":{} },  
> > "filter" : {  
> > "bool" : {  
> > "must" : {"_range_" : {  
> > "file\_size" :  
> > { "from" : 10, "to" : 10000 }}},  
> > "must" : {"_range_" : {  
> > "file\_size" :  
> > { "from" : 10001, "to" : 1000000 }  
> > }}}  
> > }  
> > } This type of query on my following database please send me example.  
> > _This is my couch database fields-_

_\_id **1628606f4283247f269be3f8ce00486f** _\*\*  
_\_rev2 -4f7058756fab1350c1b25e4832a1f7ed_  
_author duglus_  
_date 2011-10-01_\*\*  
_msg How are you_\*\*  
_location mathura_  
\*type x \*  
\*  
\* thanks!  
\*  
\*

On Thu, Jun 23, 2011 at 2:07 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> On Thu, 2011-06-23 at 10:25 +0530, sandeep tiwari wrote:
> 
> > Sir!  
> > please give me one example.  
> > thanks!
> 
> Sandeep, Ivan has provided you with a link to the documents about  
> facets, which include examples.
> 
> I suggest that you read the examples, plus as much of the docs as you  
> need to to understand the basics of Elasticsearch, try out the examples,  
> and if you're still having problems, come back with: "I tried XYZ, and  
> I'm seeing error FOO. What am I doing wrong?".
> 
> That way we will be more able to help you.
> 
> Also, see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> 
> clint
> 
> > On Wed, Jun 22, 2011 at 11:39 PM, Ivan Brusic [ivan\_brusic@yahoo.com](mailto:ivan_brusic@yahoo.com)  
> > wrote:  
> > In SQL, GROUP BY allows you to use aggregate functions on your  
> > date  
> > such as count (in your example), max, min, etc... In  
> > Elasticsearch,  
> > facets allow you to do similar aggregations.
> > 
> > ```
> > http://www.elasticsearch.org/guide/reference/api/search/facets/
> > 
> > Is your example the output of a query? If polarity_count is
> > the term
> > to group by, you can use it as a facet, and use facet filters
> > for each
> > of the cases (positive, negative, neutral).
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > On Jun 22, 8:42 am, sandeep tiwari <sandeep15...@gmail.com>
> > wrote:
> > > Sir!
> > > Result should be date wise search of group.
> > > example-
> > > 22/06/2011
> > > <polarity count>
> > > positive-1000
> > > Negative-500
> > > Neutral-200
> > > 23/06/2011
> > > <polarity count>
> > > positive-1000
> > > Negative-500
> > > Neutral-200
> > > etc........
> > > please help me sir!
> > > thanks!
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > 
> > > On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček
> > <lukas.vl...@gmail.com> wrote:
> > > > Hi,
> > >
> > > > can you give some example of the output you want to get
> > from the search
> > > > engine?
> > >
> > > > Regards,
> > > > Lukas
> > >
> > 
> > > > On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari
> > <sandeep15...@gmail.com>wrote:
> > >
> > > >> Sir!
> > > >> I want to know how use group by date in my elastic
> > search query.
> > >
> > 
> > > >> On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček
> > <lukas.vl...@gmail.com>wrote:
> > >
> > > >>> Hi,
> > >
> > > >>> can you be more specific? May be you want to look at
> > parent/child
> > > >>> feature.
> > >
> > > >>> Regards,
> > > >>> Lukas
> > >
> > 
> > > >>> On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari
> > <sandeep15...@gmail.com
> > 
> > > >>> > wrote:
> > >
> > > >>>> Hi!
> > > >>>> if anybody have been used groupby query in elastic
> > search.Please
> > > >>>> reply me.
> > >
> > > >>>>
> > Your Thankfully
> > >
> > > >>>>
> > Sandeep Kumar Tiwari
> > 
> > ```

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 23, 2011, 1:22pm UTC](https://discuss.elastic.co/t/search-query/4682/10 "2011-06-23T13:22:19Z")

</div>

\*Sir!  
\*  
\*  
\*  
\*  
\*  
\*I wnat to execute \*{

> > "query": {"match\_all":{} },  
> > "filter" : {  
> > "bool" : {  
> > "must" : {"_range_" : {  
> > "file\_size" :  
> > { "from" : 10, "to" : 10000 }}},//2011-08-06  
> > "must" : {"_range_" : {  
> > "file\_size" :  
> > { "from" : 10001, "to" : 1000000 }//here should be date  
> > }}}  
> > }  
> > } This type of query on my following database please send me example.  
> > _This is my couch database fields-_

_\_id **1628606f4283247f269be3f8ce00486f** _\*\*  
_\_rev2 -4f7058756fab1350c1b25e4832a1f7ed_  
_author duglus_  
_date 2011-10-01_\*\*  
_msg How are you_\*\*  
_location mathura_  
\*type x \*  
\*  
\* thanks!

- Show quoted text -

On Thu, Jun 23, 2011 at 6:51 PM, sandeep tiwari [sandeep15mca@gmail.com](mailto:sandeep15mca@gmail.com)wrote:

> \*Sir!  
> \*  
> \*  
> \*  
> \*  
> \*  
> \*I wnat to execute \*{
> 
> > > "query": {"match\_all":{} },  
> > > "filter" : {  
> > > "bool" : {  
> > > "must" : {"_range_" : {  
> > > "file\_size" :  
> > > { "from" : 10, "to" : 10000 }}},  
> > > "must" : {"_range_" : {  
> > > "file\_size" :  
> > > { "from" : 10001, "to" : 1000000 }  
> > > }}}  
> > > }  
> > > } This type of query on my following database please send me example.  
> > > _This is my couch database fields-_
> 
> _\_id **1628606f4283247f269be3f8ce00486f** _\*\*  
> _\_rev2 -4f7058756fab1350c1b25e4832a1f7ed_  
> _author duglus_  
> _date 2011-10-01_\*\*  
> _msg How are you_\*\*  
> _location mathura_  
> \*type x \*  
> \*  
> \* thanks!  
> \*  
> \*
> 
> On Thu, Jun 23, 2011 at 2:07 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:
> 
> > On Thu, 2011-06-23 at 10:25 +0530, sandeep tiwari wrote:
> > 
> > > Sir!  
> > > please give me one example.  
> > > thanks!
> > 
> > Sandeep, Ivan has provided you with a link to the documents about  
> > facets, which include examples.
> > 
> > I suggest that you read the examples, plus as much of the docs as you  
> > need to to understand the basics of Elasticsearch, try out the examples,  
> > and if you're still having problems, come back with: "I tried XYZ, and  
> > I'm seeing error FOO. What am I doing wrong?".
> > 
> > That way we will be more able to help you.
> > 
> > Also, see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> > 
> > clint
> > 
> > > On Wed, Jun 22, 2011 at 11:39 PM, Ivan Brusic [ivan\_brusic@yahoo.com](mailto:ivan_brusic@yahoo.com)  
> > > wrote:  
> > > In SQL, GROUP BY allows you to use aggregate functions on your  
> > > date  
> > > such as count (in your example), max, min, etc... In  
> > > Elasticsearch,  
> > > facets allow you to do similar aggregations.
> > > 
> > > ```
> > > http://www.elasticsearch.org/guide/reference/api/search/facets/
> > > 
> > > Is your example the output of a query? If polarity_count is
> > > the term
> > > to group by, you can use it as a facet, and use facet filters
> > > for each
> > > of the cases (positive, negative, neutral).
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > On Jun 22, 8:42 am, sandeep tiwari <sandeep15...@gmail.com>
> > > wrote:
> > > > Sir!
> > > > Result should be date wise search of group.
> > > > example-
> > > > 22/06/2011
> > > > <polarity count>
> > > > positive-1000
> > > > Negative-500
> > > > Neutral-200
> > > > 23/06/2011
> > > > <polarity count>
> > > > positive-1000
> > > > Negative-500
> > > > Neutral-200
> > > > etc........
> > > > please help me sir!
> > > > thanks!
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > 
> > > > On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček
> > > <lukas.vl...@gmail.com> wrote:
> > > > > Hi,
> > > >
> > > > > can you give some example of the output you want to get
> > > from the search
> > > > > engine?
> > > >
> > > > > Regards,
> > > > > Lukas
> > > >
> > > 
> > > > > On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari
> > > <sandeep15...@gmail.com>wrote:
> > > >
> > > > >> Sir!
> > > > >> I want to know how use group by date in my elastic
> > > search query.
> > > >
> > > 
> > > > >> On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček
> > > <lukas.vl...@gmail.com>wrote:
> > > >
> > > > >>> Hi,
> > > >
> > > > >>> can you be more specific? May be you want to look at
> > > parent/child
> > > > >>> feature.
> > > >
> > > > >>> Regards,
> > > > >>> Lukas
> > > >
> > > 
> > > > >>> On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari
> > > <sandeep15...@gmail.com
> > > 
> > > > >>> > wrote:
> > > >
> > > > >>>> Hi!
> > > > >>>> if anybody have been used groupby query in elastic
> > > search.Please
> > > > >>>> reply me.
> > > >
> > > > >>>>
> > > Your Thankfully
> > > >
> > > > >>>>
> > > Sandeep Kumar Tiwari
> > > 
> > > ```

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 23, 2011, 1:32pm UTC](https://discuss.elastic.co/t/search-query/4682/11 "2011-06-23T13:32:15Z")

</div>

Hi Sandeep

> I wnat to execute {
> 
> > > "query": {"match\_all":{} },  
> > > "filter" : {  
> > > "bool" : {  
> > > "must" : {"range" : {  
> > > "file\_size" :  
> > > { "from" : 10, "to" : 10000 }}},//2011-08-06  
> > > "must" : {"range" : {  
> > > "file\_size" :  
> > > { "from" : 10001, "to" : 1000000 }//here should be date  
> > > }}}  
> > > }  
> > > } This type of query on my following database please send me  
> > > example.

> This is my couch database fields-
> 
> \_id 1628606f4283247f269be3f8ce00486f  
> \_rev2 -4f7058756fab1350c1b25e4832a1f7ed  
> author duglus  
> date 2011-10-01  
> msg How are you  
> location mathura  
> type x

Do you have your data in Elasticsearch yet?

What problem are you having when you try to do a search like that?

Note, in your previous email, you talked about grouping - the above  
query doesn't group. It will just return docs that fit into your  
ranges.

If you want to 'group' then you should be looking at using facets, as  
Ivan pointed out.

So, given your example data, what result are you wanting? Are you able  
to state the result you want in English, instead of code? For example:

I want to know the total number of docs that include the keywords  
"how are you", in location "mathura", grouped by week using the date  
field

clint

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 23, 2011, 1:54pm UTC](https://discuss.elastic.co/t/search-query/4682/12 "2011-06-23T13:54:23Z")

</div>

Sir!  
I want to all result between given date-  
$ curl -XGET '192.168.1.24:9200/mydb2/mytype2/\_search?pretty=true' -d  
'{"query"  
:{"match\_all":{}},"filter":{"range":{"file\_size":{"from":"2011-09-02","to":"201  
1-10-01"}}}}'  
{  
"took" : 2,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}  
But I want give result between 2011-09-02 and 201  
1-10-01  
Thanks!  
On Thu, Jun 23, 2011 at 7:02 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> Hi Sandeep
> 
> > I wnat to execute {
> > 
> > > > "query": {"match\_all":{} },  
> > > > "filter" : {  
> > > > "bool" : {  
> > > > "must" : {"range" : {  
> > > > "file\_size" :  
> > > > { "from" : 10, "to" : 10000 }}},//2011-08-06  
> > > > "must" : {"range" : {  
> > > > "file\_size" :  
> > > > { "from" : 10001, "to" : 1000000 }//here should be date  
> > > > }}}  
> > > > }  
> > > > } This type of query on my following database please send me  
> > > > example.
> 
> > This is my couch database fields-
> > 
> > \_id 1628606f4283247f269be3f8ce00486f  
> > \_rev2 -4f7058756fab1350c1b25e4832a1f7ed  
> > author duglus  
> > date 2011-10-01  
> > msg How are you  
> > location mathura  
> > type x
> 
> Do you have your data in Elasticsearch yet?
> 
> What problem are you having when you try to do a search like that?
> 
> Note, in your previous email, you talked about grouping - the above  
> query doesn't group. It will just return docs that fit into your  
> ranges.
> 
> If you want to 'group' then you should be looking at using facets, as  
> Ivan pointed out.
> 
> So, given your example data, what result are you wanting? Are you able  
> to state the result you want in English, instead of code? For example:
> 
> I want to know the total number of docs that include the keywords  
> "how are you", in location "mathura", grouped by week using the date  
> field
> 
> clint

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 23, 2011, 2:06pm UTC](https://discuss.elastic.co/t/search-query/4682/13 "2011-06-23T14:06:47Z")

</div>

Hi Sandeep

On Thu, 2011-06-23 at 19:24 +0530, sandeep tiwari wrote:

> Sir!  
> I want to all result between given date-  
> $ curl -XGET '192.168.1.24:9200/mydb2/mytype2/\_search?pretty=true'  
> -d '{"query"  
> :{"match\_all":{}},"filter":{"range":{"file\_size":{"from":"2011-09-02","to":"201  
> 1-10-01"}}}}'

Why are you using the field 'file\_size' as a date field? That doesn't  
seem to make much sense. In your previous email, you have a 'date'  
field.

So, I think what you're looking for is:

curl -XGET '[http://127.0.0.1:9200/mydb2/mytype2/\_search?pretty=1](http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=1)' -d '  
{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"range" : {  
"date" : {  
"lte" : "2011-10-01",  
"gte" : "2011-09-02"  
}  
}  
}  
}  
}  
}  
'

clint

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 23, 2011, 2:22pm UTC](https://discuss.elastic.co/t/search-query/4682/14 "2011-06-23T14:22:52Z")

</div>

thanks lot sir!  
one other request if you have some material regarding elasticsearch query  
please send me because I am new in that field but not in java.

```
                                           Your thankfully

        Sandeep Kumar tiwari

```

On Thu, Jun 23, 2011 at 7:36 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> Hi Sandeep
> 
> On Thu, 2011-06-23 at 19:24 +0530, sandeep tiwari wrote:
> 
> > Sir!  
> > I want to all result between given date-  
> > $ curl -XGET '192.168.1.24:9200/mydb2/mytype2/\_search?pretty=true'  
> > -d '{"query"
> 
> :{"match\_all":{}},"filter":{"range":{"file\_size":{"from":"2011-09-02","to":"201
> 
> > 1-10-01"}}}}'
> 
> Why are you using the field 'file\_size' as a date field? That doesn't  
> seem to make much sense. In your previous email, you have a 'date'  
> field.
> 
> So, I think what you're looking for is:
> 
> curl -XGET '[http://127.0.0.1:9200/mydb2/mytype2/\_search?pretty=1](http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=1)' -d '  
> {  
> "query" : {  
> "constant\_score" : {  
> "filter" : {  
> "range" : {  
> "date" : {  
> "lte" : "2011-10-01",  
> "gte" : "2011-09-02"  
> }  
> }  
> }  
> }  
> }  
> }  
> '
> 
> clint

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 23, 2011, 2:34pm UTC](https://discuss.elastic.co/t/search-query/4682/15 "2011-06-23T14:34:34Z")

</div>

On Thu, 2011-06-23 at 19:52 +0530, sandeep tiwari wrote:

> thanks lot sir!  
> one other request if you have some material regarding elasticsearch  
> query please send me because I am new in that field but not in java.

All the information you need is available on the site:

> **[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.

clint

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 24, 2011, 5:11am UTC](https://discuss.elastic.co/t/search-query/4682/16 "2011-06-24T05:11:24Z")

</div>

Sir!  
query which was tell by you work properly but when I want to get  
information of two individual month by this query,result come out only one  
month not both.  
my query is-  
curl -XGET '[http://127.0.0.1:9200/mydb2/mytype2/\_search?pretty=1](http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=1)' -d  
'  
{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"range" : {  
"date" : {  
"lte" : "2011-09-01",  
"gte" : "2011-09-10"  
}  
}  
},  
"range" : {  
"date" : {  
"lte" : "2011-10-07",  
"gte" : "2011-10-17"  
}  
}  
}  
}  
}  
}'  
result come out is only 9th month.please guide me.

```
your faithfully

```

Sandeep Tiwari

On Thu, Jun 23, 2011 at 8:04 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> On Thu, 2011-06-23 at 19:52 +0530, sandeep tiwari wrote:
> 
> > thanks lot sir!  
> > one other request if you have some material regarding elasticsearch  
> > query please send me because I am new in that field but not in java.
> 
> All the information you need is available on the site:
> 
> [http://www.elasticsearch.org/](http://www.elasticsearch.org/)
> 
> clint

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 24, 2011, 9:55am UTC](https://discuss.elastic.co/t/search-query/4682/17 "2011-06-24T09:55:58Z")

</div>

On Fri, 2011-06-24 at 10:41 +0530, sandeep tiwari wrote:

> Sir!  
> query which was tell by you work properly but when I want to get  
> information of two individual month by this query,result come out only  
> one month not both.

you need to combine your filters with and|or|not filters

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.

> **[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.

> **[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.

clint

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 24, 2011, 10:35am UTC](https://discuss.elastic.co/t/search-query/4682/18 "2011-06-24T10:35:14Z")

</div>

Sir!  
After executing the query there is some exception please check query-  
'{  
"filtered":{  
"query":{  
"constant\_score" : {  
"filter" : {"and":[{  
"range" : {  
"date" : {  
"lte" : "2011-09-01",  
"gte" : "2011-09-10"

```
          }
       }
    }],

```

"and":[{"range" : {  
"date" : {  
"lte" : "2011-10-07",  
"gte" : "2011-10-17"  
}  
}  
}]  
}  
}  
}  
}  
}'

On Fri, Jun 24, 2011 at 3:25 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> On Fri, 2011-06-24 at 10:41 +0530, sandeep tiwari wrote:
> 
> > Sir!  
> > query which was tell by you work properly but when I want to get  
> > information of two individual month by this query,result come out only  
> > one month not both.
> 
> you need to combine your filters with and|or|not filters
> 
> see:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/and-filter.html)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/or-filter.html)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/not-filter.html)
> 
> clint

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 24, 2011, 11:00am UTC](https://discuss.elastic.co/t/search-query/4682/19 "2011-06-24T11:00:15Z")

</div>

On Fri, 2011-06-24 at 16:05 +0530, sandeep tiwari wrote:

> Sir!  
> After executing the query there is some exception please check  
> query-

Sandeep - please read the docs. your syntax error is pretty obvious.

> **[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.

> **[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.

> **[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.

clint

---

<div class="post-metadata">

### Author: ![sandeep15mca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep15mca/32/3178_2.png) [@sandeep15mca](https://discuss.elastic.co/u/sandeep15mca)
#### Post date: [June 29, 2011, 9:50am UTC](https://discuss.elastic.co/t/search-query/4682/20 "2011-06-29T09:50:04Z")

</div>

On Fri, Jun 24, 2011 at 4:30 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> On Fri, 2011-06-24 at 16:05 +0530, sandeep tiwari wrote:
> 
> > Sir!  
> > After executing the query there is some exception please check  
> > query-
> 
> Sandeep - please read the docs. your syntax error is pretty obvious.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/and-filter.html)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/or-filter.html)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/not-filter.html)

Sir!  
I try to open docs on [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/docs) but its give 404  
code error while speed is to good I request to you please guide me where  
syntax error in-  
curl -XGET '[http://127.0.0.1:9200/mydb2/mytype2/\_search?pretty=true](http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=true)' -d '  
'{  
"filtered":{  
"query":{  
"constant\_score" : {  
"filter" : {"and":[{  
"range" : {  
"date" : {  
"lte" : "2011-09-01",  
"gte" : "2011-09-10"

```
          }
       }
    }],

```

"and":[{"range" : {  
"date" : {  
"lte" : "2011-10-07",  
"gte" : "2011-10-17"  
}  
}  
}]  
}  
}  
}  
}  
}'  
because is is generated exception.  
thanks

> clint

[Next page](https://discuss.elastic.co/t/search-query/4682.md?page=2)
