Get Count Using has-child query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Get Count Using has-child query

Arulkumar
Hi ,

 1. How to get document count in an index using child query.?

      I am using the query to get count is......

      curl -XGET 'http://localhost:9200/dbtest/parent/_count' -d
'{"has_child" : {"type" : "child", "query" :{ "term" :
{       "myfield": "test" } }} }'

     But i am getting like this...........

{"count":0,"_shards":{"total":2,"successful":0,"failed":2,"failures":
[{"index":"dbtest","shard":
0,"reason":"BroadcastShardOperationFailedException[[dbtest]0] ];
nested:"},{"index":"dbtest","shard":
1,"reason":"BroadcastShardOperationFailedException[[dbtest]1] ];
nested: "}]}}


Can any one help me.........
Reply | Threaded
Open this post in threaded view
|

Re: Get Count Using has-child query

kimchy
Administrator
Count API does not support child query, just issue a search request with 0 size and look at the total hits.

On Tuesday, January 11, 2011 at 10:42 AM, Arulkumar wrote:

Hi ,

1. How to get document count in an index using child query.?

I am using the query to get count is......

curl -XGET 'http://localhost:9200/dbtest/parent/_count' -d
'{"has_child" : {"type" : "child", "query" :{ "term" :
{ "myfield": "test" } }} }'

But i am getting like this...........

{"count":0,"_shards":{"total":2,"successful":0,"failed":2,"failures":
[{"index":"dbtest","shard":
0,"reason":"BroadcastShardOperationFailedException[[dbtest]0] ];
nested:"},{"index":"dbtest","shard":
1,"reason":"BroadcastShardOperationFailedException[[dbtest]1] ];
nested: "}]}}


Can any one help me.........

Reply | Threaded
Open this post in threaded view
|

Re: Get Count Using has-child query

kimchy
Administrator
ok, pushed support for it: https://github.com/elasticsearch/elasticsearch/issues/issue/621.

On Tuesday, January 11, 2011 at 10:01 PM, Shay Banon wrote:

Count API does not support child query, just issue a search request with 0 size and look at the total hits.

On Tuesday, January 11, 2011 at 10:42 AM, Arulkumar wrote:

Hi ,

1. How to get document count in an index using child query.?

I am using the query to get count is......

curl -XGET 'http://localhost:9200/dbtest/parent/_count' -d
'{"has_child" : {"type" : "child", "query" :{ "term" :
{ "myfield": "test" } }} }'

But i am getting like this...........

{"count":0,"_shards":{"total":2,"successful":0,"failed":2,"failures":
[{"index":"dbtest","shard":
0,"reason":"BroadcastShardOperationFailedException[[dbtest]0] ];
nested:"},{"index":"dbtest","shard":
1,"reason":"BroadcastShardOperationFailedException[[dbtest]1] ];
nested: "}]}}


Can any one help me.........


Reply | Threaded
Open this post in threaded view
|

Re: Get Count Using has-child query

kimchy
Administrator
Oops, wrong reply to, this change is not related to this...

On Tuesday, January 11, 2011 at 10:05 PM, Shay Banon wrote:

ok, pushed support for it: https://github.com/elasticsearch/elasticsearch/issues/issue/621.

On Tuesday, January 11, 2011 at 10:01 PM, Shay Banon wrote:

Count API does not support child query, just issue a search request with 0 size and look at the total hits.

On Tuesday, January 11, 2011 at 10:42 AM, Arulkumar wrote:

Hi ,

1. How to get document count in an index using child query.?

I am using the query to get count is......

curl -XGET 'http://localhost:9200/dbtest/parent/_count' -d
'{"has_child" : {"type" : "child", "query" :{ "term" :
{ "myfield": "test" } }} }'

But i am getting like this...........

{"count":0,"_shards":{"total":2,"successful":0,"failed":2,"failures":
[{"index":"dbtest","shard":
0,"reason":"BroadcastShardOperationFailedException[[dbtest]0] ];
nested:"},{"index":"dbtest","shard":
1,"reason":"BroadcastShardOperationFailedException[[dbtest]1] ];
nested: "}]}}


Can any one help me.........



Reply | Threaded
Open this post in threaded view
|

Re: Get Count Using has-child query

Arulkumar
thank you shay......

On Jan 13, 12:23 am, Shay Banon <[hidden email]> wrote:

> Oops, wrong reply to, this change is not related to this...
>
> On Tuesday, January 11, 2011 at 10:05 PM, Shay Banon wrote:
> > ok, pushed support for it:https://github.com/elasticsearch/elasticsearch/issues/issue/621.
> > On Tuesday, January 11, 2011 at 10:01 PM, Shay Banon wrote:
>
> > > Count API does not support child query, just issue a search request with 0 size and look at the total hits.
> > > On Tuesday, January 11, 2011 at 10:42 AM, Arulkumar wrote:
>
> > > > Hi ,
>
> > > >  1. How to get document count in an index using child query.?
>
> > > >  I am using the query to get count is......
>
> > > >  curl -XGET 'http://localhost:9200/dbtest/parent/_count'-d
> > > > '{"has_child" : {"type" : "child", "query" :{ "term" :
> > > > { "myfield": "test" } }} }'
>
> > > >  But i am getting like this...........
>
> > > > {"count":0,"_shards":{"total":2,"successful":0,"failed":2,"failures":
> > > > [{"index":"dbtest","shard":
> > > > 0,"reason":"BroadcastShardOperationFailedException[[dbtest]0] ];
> > > > nested:"},{"index":"dbtest","shard":
> > > > 1,"reason":"BroadcastShardOperationFailedException[[dbtest]1] ];
> > > > nested: "}]}}
>
> > > > Can any one help me.........