Delete by query with has_parent

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in elasticsearch by
referencing the parentID.

I can search for all children of a certain parent by running the following
command,

curl -XGET 'http://localhost:9200/index/child/_search' -d
"{"query":{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}}"
{"took":48,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":214,"max_score":1.0,"hits":[{"_index":"index","_type":"child","_id":"512e48350a57150000000018","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000019","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001a","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001d","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001e","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001f","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000020","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000021","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000022","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000023","_score":1.0}]}}

So that works fine. When I want to delete these documents though, because I
am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/_query' -d
"{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}"
{"ok":true,"_indices":{"index":{"_shards":{"total":5,"successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ] [Briquette]
[index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]: Failed to
execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed to parse
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:220)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareDeleteByQuery(InternalIndexShard.java:370)
at
org.elasticsearch.action.deletebyquery.TransportShardDeleteByQueryAction.shardOperationOnPrimary(TransportShardDeleteByQueryAction.java:95)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at
org.elasticsearch.index.query.HasParentQueryParser.parse(HasParentQueryParser.java:153)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:188)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:268)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

I think this is a bug. What ES version are you using?

On 28 February 2013 00:07, Simon snmaynard@gmail.com wrote:

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in elasticsearch by
referencing the parentID.

I can search for all children of a certain parent by running the following
command,

curl -XGET 'http://localhost:9200/index/child/_search' -d
"{"query":{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}}"

{"took":48,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":214,"max_score":1.0,"hits":[{"_index":"index","_type":"child","_id":"512e48350a57150000000018","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000019","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001a","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001d","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001e","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001f","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000020","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000021","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000022","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000023","_score":1.0}]}}

So that works fine. When I want to delete these documents though, because
I am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/_query' -d
"{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}"

{"ok":true,"_indices":{"index":{"_shards":{"total":5,"successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ] [Briquette]
[index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]: Failed to
execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed to
parse
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:220)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareDeleteByQuery(InternalIndexShard.java:370)
at
org.elasticsearch.action.deletebyquery.TransportShardDeleteByQueryAction.shardOperationOnPrimary(TransportShardDeleteByQueryAction.java:95)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at
org.elasticsearch.index.query.HasParentQueryParser.parse(HasParentQueryParser.java:153)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:188)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:268)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Met vriendelijke groet,

Martijn van Groningen

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

I'm currently using 0.20.5

On Wednesday, February 27, 2013 3:17:12 PM UTC-8, Martijn v Groningen wrote:

I think this is a bug. What ES version are you using?

On 28 February 2013 00:07, Simon <snma...@gmail.com <javascript:>> wrote:

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in elasticsearch
by referencing the parentID.

I can search for all children of a certain parent by running the
following command,

curl -XGET 'http://localhost:9200/index/child/_search' -d
"{"query":{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}}"

{"took":48,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":214,"max_score":1.0,"hits":[{"_index":"index","_type":"child","_id":"512e48350a57150000000018","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000019","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001a","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001d","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001e","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a5715000000001f","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000020","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000021","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000022","_score":1.0},{"_index":"index","_type":"child","_id":"512e48350a57150000000023","_score":1.0}]}}

So that works fine. When I want to delete these documents though, because
I am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/_query' -d
"{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}"

{"ok":true,"_indices":{"index":{"_shards":{"total":5,"successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ] [Briquette]
[index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]: Failed to
execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":"parent","query":{"term":{"name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed to
parse
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:220)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareDeleteByQuery(InternalIndexShard.java:370)
at
org.elasticsearch.action.deletebyquery.TransportShardDeleteByQueryAction.shardOperationOnPrimary(TransportShardDeleteByQueryAction.java:95)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at
org.elasticsearch.index.query.HasParentQueryParser.parse(HasParentQueryParser.java:153)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:188)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:268)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
Met vriendelijke groet,

Martijn van Groningen

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

After a quick look at the code it seems to me that all parent/child queries
don't work via delete by query api. I have opened an issue to further
investigate this issue:

Thanks for bringing this up!

On 28 February 2013 00:20, Simon snmaynard@gmail.com wrote:

I'm currently using 0.20.5

On Wednesday, February 27, 2013 3:17:12 PM UTC-8, Martijn v Groningen
wrote:

I think this is a bug. What ES version are you using?

On 28 February 2013 00:07, Simon snma...@gmail.com wrote:

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in elasticsearch
by referencing the parentID.

I can search for all children of a certain parent by running the
following command,

curl -XGET 'http://localhost:9200/index/child/_searchhttp://localhost:9200/index/child/_search'
-d "{"query":{"has_parent":{**"parent_type":"parent","

query":{"term":{"name":"Name"}}}}}"
{"took":48,"timed_out":false,"
_shards":{"total":5,"**
successful":5,"failed":0},"hits":{"total":214,"max_score"
:1.0,"hits":[{"index":"index","_type":"child","_id":"
512e48350a57150000000018","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000019","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001a","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001d","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001e","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001f","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000020","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000021","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000022","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000023","**score":1.0}]}}

So that works fine. When I want to delete these documents though,
because I am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/queryhttp://localhost:9200/index/child/_query'
-d "{"has_parent":{"parent
type":"parent","query":{*
"term":{"name":"Name"}}}}
"
{"ok":true,"_indices":{"index"
:{"_shards":{"total":5,"*
successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ]
[Briquette] [index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]:
Failed to execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":
"parent","query":{"term":{"**
name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed
to parse
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:220)
at org.elasticsearch.index.shard.service.InternalIndexShard.
prepareDeleteByQuery(InternalIndexShard.java:370)
at org.elasticsearch.action.deletebyquery.
TransportShardDeleteByQueryAct
ion.shardOperationOnPrimary(

TransportShardDeleteByQueryAct
ion.java:95)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOperationAction$AsyncShardOperationAction.
*performOnPrimary(TransportShardReplicationOperationAction.java:532)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOpera
tionAction$
*
AsyncShardOperationAction$1.**run(TransportShardReplicationOpera
tionAction.java:430)
at java.util.concurrent.ThreadPoolExecutor$Worker.
runTask(ThreadPoolExecutor.**java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.**java:680)
Caused by: java.lang.NullPointerException
at org.elasticsearch.index.query.HasParentQueryParser.parse(
HasParentQueryParser.java:153)
at org.elasticsearch.index.query.**QueryParseContext.**parseInnerQuery(
**QueryParseContext.java:188)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**268)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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 elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No worries, thanks for the prompt response, I'll keep an eye on the issue!

On Wednesday, February 27, 2013 3:27:08 PM UTC-8, Martijn v Groningen wrote:

After a quick look at the code it seems to me that all parent/child
queries don't work via delete by query api. I have opened an issue to
further investigate this issue:
https://github.com/elasticsearch/elasticsearch/issues/2705

Thanks for bringing this up!

On 28 February 2013 00:20, Simon <snma...@gmail.com <javascript:>> wrote:

I'm currently using 0.20.5

On Wednesday, February 27, 2013 3:17:12 PM UTC-8, Martijn v Groningen
wrote:

I think this is a bug. What ES version are you using?

On 28 February 2013 00:07, Simon snma...@gmail.com wrote:

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in elasticsearch
by referencing the parentID.

I can search for all children of a certain parent by running the
following command,

curl -XGET 'http://localhost:9200/index/child/_searchhttp://localhost:9200/index/child/_search'
-d "{"query":{"has_parent":{**"parent_type":"parent","

query":{"term":{"name":"Name"}}}}}"
{"took":48,"timed_out":false,"
_shards":{"total":5,"**
successful":5,"failed":0},"hits":{"total":214,"max_score"
:1.0,"hits":[{"index":"index","_type":"child","_id":"
512e48350a57150000000018","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000019","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001a","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001d","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001e","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001f","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000020","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000021","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000022","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000023","**score":1.0}]}}

So that works fine. When I want to delete these documents though,
because I am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/queryhttp://localhost:9200/index/child/_query'
-d "{"has_parent":{"parent
type":"parent","query":{*
"term":{"name":"Name"}}}}
"
{"ok":true,"_indices":{"index"
:{"_shards":{"total":5,"*
successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ]
[Briquette] [index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]:
Failed to execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":
"parent","query":{"term":{"**
name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed
to parse
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:220)
at org.elasticsearch.index.shard.service.InternalIndexShard.
prepareDeleteByQuery(InternalIndexShard.java:370)
at org.elasticsearch.action.deletebyquery.
TransportShardDeleteByQueryAct
ion.shardOperationOnPrimary(

TransportShardDeleteByQueryAct
ion.java:95)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOpera**tionAction$AsyncShardOperationAction.
performOnPrimary(TransportShardReplicationOpera
tionAction.java:532)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOpera
tionAction$

AsyncShardOperationAction$1.**run(TransportShardReplicationOpera
tionAction.java:430)
at java.util.concurrent.ThreadPoolExecutor$Worker.
runTask(ThreadPoolExecutor.**java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.**java:680)
Caused by: java.lang.NullPointerException
at org.elasticsearch.index.query.HasParentQueryParser.parse(
HasParentQueryParser.java:153)
at org.elasticsearch.index.query.QueryParseContext.
parseInnerQuery(**QueryParseContext.java:188)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**268)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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 elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi

I am facing same issue of deleting child documents from elasticsearch.

My ElasticSeacrch version is: elasticsearch-0.90.0.RC2

has this issue been resolved ?

On Thursday, February 28, 2013 12:13:00 AM UTC, Simon wrote:

No worries, thanks for the prompt response, I'll keep an eye on the issue!

On Wednesday, February 27, 2013 3:27:08 PM UTC-8, Martijn v Groningen
wrote:

After a quick look at the code it seems to me that all parent/child
queries don't work via delete by query api. I have opened an issue to
further investigate this issue:
https://github.com/elasticsearch/elasticsearch/issues/2705

Thanks for bringing this up!

On 28 February 2013 00:20, Simon snma...@gmail.com wrote:

I'm currently using 0.20.5

On Wednesday, February 27, 2013 3:17:12 PM UTC-8, Martijn v Groningen
wrote:

I think this is a bug. What ES version are you using?

On 28 February 2013 00:07, Simon snma...@gmail.com wrote:

I have the following schema in elasticsearch.

parent = {
name: "Name",
id: "parentID"
}

child = {
name:"Name here",
id: "childID"
}

When adding a child, I add it as a child of the parent in
elasticsearch by referencing the parentID.

I can search for all children of a certain parent by running the
following command,

curl -XGET 'http://localhost:9200/index/child/_searchhttp://localhost:9200/index/child/_search'
-d "{"query":{"has_parent":{**"parent_type":"parent","

query":{"term":{"name":"Name"}}}}}"
{"took":48,"timed_out":false,"
_shards":{"total":5,"**
successful":5,"failed":0},"hits":{"total":214,"max_score"
:1.0,"hits":[{"index":"index","_type":"child","_id":"
512e48350a57150000000018","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000019","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001a","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001d","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a5715000000001e","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a5715000000001f","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000020","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000021","**
score":1.0},{"index":"index","_type":"child","_id":"
512e48350a57150000000022","
score":1.0},{"_index":"index",
"_type":"child","id":"**512e48350a57150000000023","**score":1.0}]}}

So that works fine. When I want to delete these documents though,
because I am also going to delete the parent, I get the following,

curl -XDELETE 'http://localhost:9200/index/child/queryhttp://localhost:9200/index/child/_query'
-d "{"has_parent":{"parent
type":"parent","query":{*
"term":{"name":"Name"}}}}
"
{"ok":true,"_indices":{"index"
:{"_shards":{"total":5,"*
successful":0,"failed":5}}}}

In the elasticsearch log I see,

[2013-02-27 14:19:02,281][DEBUG][action.deletebyquery ]
[Briquette] [index][2], node[VsFgl8kKRz2e4yhjsANFvg], [P], s[STARTED]:
Failed to execute [delete_by_query {[index][child], query
[{"has_parent":{"parent_type":
"parent","query":{"term":{"**
name":"Name"}}}}]}]
org.elasticsearch.index.query.QueryParsingException: [index] Failed
to parse
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:220)
at org.elasticsearch.index.shard.service.InternalIndexShard.
prepareDeleteByQuery(InternalIndexShard.java:370)
at org.elasticsearch.action.deletebyquery.
TransportShardDeleteByQueryAct
ion.shardOperationOnPrimary(

TransportShardDeleteByQueryAct
ion.java:95)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOperationAction$
AsyncShardOperationAction.performOnPrimary(
TransportShardReplicationOperationAction.java:532)
at org.elasticsearch.action.support.replication.
TransportShardReplicationOpera
tionAction$**
AsyncShardOperationAction$1.**run(TransportShardReplicationOpera
tionAction.java:430)
at java.util.concurrent.ThreadPoolExecutor$Worker.
runTask(ThreadPoolExecutor.**java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.**java:680)
Caused by: java.lang.NullPointerException
at org.elasticsearch.index.query.HasParentQueryParser.parse(
HasParentQueryParser.java:153)
at org.elasticsearch.index.query.QueryParseContext.
parseInnerQuery(**QueryParseContext.java:188)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**268)
at org.elasticsearch.index.query.IndexQueryParserService.parse(
IndexQueryParserService.java:**216)
... 7 more

Does anyone have any idea why deleting by a query isn't working with
has_parent for me?

Thanks,

--
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 elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

--
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.
For more options, visit https://groups.google.com/groups/opt_out.