Get Count Using has-child query


(Arulkumar) #1

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


(Shay Banon) #2

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


(Shay Banon) #3

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


(Shay Banon) #4

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


(Arulkumar) #5

thank you shay......

On Jan 13, 12:23 am, Shay Banon shay.ba...@elasticsearch.com 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.........


(system) #6