Hi,
I am trying to delete some elements with delete_by_query.
I should remove 5 elements:
curl -XGET 'localhost:9200/product_metadata/_count?pretty' -d '{"query": {"match":{"type.identifier": "plastic"}}}'
If I executed the delete by query I receive and error:
-bash-4.2$ curl -XPOST 'localhost:9200/product_metadata/delete_by_query?pretty' -d '{"query": {"match":{"type.identifier": "plastic"}}}'
{
"error" : {
"root_cause" : [
{
"type" : "invalid_type_name_exception",
"reason" : "Document mapping type name can't start with '', found: [delete_by_query]"
}
],
"type" : "invalid_type_name_exception",
"reason" : "Document mapping type name can't start with '', found: [_delete_by_query]"
},
"status" : 400
}
This is one of the element I found with the search:
{
"_index" : "product_metadata",
"_type" : "product_metadata",
"_id" : "a234255e-bedb-40f6-95b8-1dab5504e8f7",
"_score" : 5.5263844,
"_source" : {
"@class" : "it.altecspace.asdp.productmanager.curator.CuratedProduct",
"name" : "STA_LB_PLA_BROWSE_20180208_V12.cdf",
"id" : {
"uuid" : "a234255e-bedb-40f6-95b8-1dab5504e8f7"
},
"type" : {
"@class" : "it.altecspace.asdp.core.api.product.ProductType",
"identifier" : "lasco/plastic+ahead",
"description" : "Plastic product"
},
"metadata" : {
"asdp" : {
"product" : {
"ingested_on" : "20180213053542923"
}
}
},
"location" : {
"@class" : "it.altecspace.asdp.productmanager.archivist.ProductLocation",
"archive" : "default",
"location" : "file:///asdp-data/data/fsarchive/archive/a234255e-bedb-40f6-95b8-1dab5504e8f7/"
}
}
}
Where do I make a mistake?
I am able to delete each element specifying index and type:
curl -XDELETE http://localhost:9200/product_metadata/product_metadata/810ee996-6d45-4cb5-964e-f205b4a94431/?pretty
But I need to use delete by query.
If I specify index and type I receive this:
-bash-4.2$ curl -XPOST 'localhost:9200/product_metadata/product_metadata/_delete_by_query?pretty' -d '{"query": {"match":{"type.identifier": "plastic"}}}'
{
"_index" : "product_metadata",
"_type" : "product_metadata",
"_id" : "_delete_by_query",
"_version" : 8,
"result" : "updated",
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"created" : false
}
Bye