Delete By Query


(ppcharli) #1

Hi,

If I run a query I get results but if I run the same query to delete does
not work.

curl -XGET 'http://localhost:9200/alias1/facturas/_search?pretty' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 4,
"successful" : 4,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1001"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1005"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1006"}
} ]
}
}

curl -XDELETE 'http://localhost:9200/alias1/facturas/_query' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'

{"ok":true,"_indices":{"indice1":{"_shards":{"total":4,"successful":0,"failed":4}}}}

Thanks,


(dkoum) #2

I asked the same question a while ago, response was to drop first the
"query" and use a "query_string" directly like this: -d
'{"query_string":{"query":"cliente: .....

On Fri, Jun 22, 2012 at 9:43 AM, ppcharli ppcharli@gmail.com wrote:

Hi,

If I run a query I get results but if I run the same query to delete does
not work.

curl -XGET 'http://localhost:9200/alias1/facturas/_search?pretty' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 4,
"successful" : 4,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1001"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1005"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1006"}
} ]
}
}

curl -XDELETE 'http://localhost:9200/alias1/facturas/_query' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'

{"ok":true,"_indices":{"indice1":{"_shards":{"total":4,"successful":0,"failed":4}}}}

Thanks,


(ppcharli) #3

Thanks Dionisis ,

On Friday, June 22, 2012 8:53:31 AM UTC+2, dkoum wrote:

I asked the same question a while ago, response was to drop first the
"query" and use a "query_string" directly like this: -d
'{"query_string":{"query":"cliente: .....

On Fri, Jun 22, 2012 at 9:43 AM, ppcharli ppcharli@gmail.com wrote:

Hi,

If I run a query I get results but if I run the same query to delete does
not work.

curl -XGET 'http://localhost:9200/alias1/facturas/_search?pretty' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 4,
"successful" : 4,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1001"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1005"}
}, {
"_index" : "indice1",
"_type" : "facturas",
"_id" : "1-1",
"_score" : 1.0, "_source" :
{"id":"1","cliente":"cliente1","org":"1","total":"1006"}
} ]
}
}

curl -XDELETE 'http://localhost:9200/alias1/facturas/_query' -d
'{"query":{"query_string":{"query":"cliente:(cliente*)"}}}'

{"ok":true,"_indices":{"indice1":{"_shards":{"total":4,"successful":0,"failed":4}}}}

Thanks,


(system) #4