Reputation: 1314
I am using Elastic Search version number: "1.7.1"
But whenever I run the _delete_by_query
I get this error on all my indexes.
Here's the mapping for one of the indexes
{
"composite_task_group": {
"mappings": {
"stock_take": {
"dynamic": "true",
"dynamic_templates": [
{
"strings": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match_mapping_type": "string"
}
}
],
"properties": {
"data": {
"properties": {
"attributes.container_id": {
"type": "string",
"index": "not_analyzed"
},
"attributes.container_label": {
"type": "string",
"index": "not_analyzed"
},
"attributes.container_type": {
"type": "string",
"index": "not_analyzed"
},
"attributes.ref_id": {
"type": "string",
"index": "not_analyzed"
},
"attributes.stock_take_id": {
"type": "string",
"index": "not_analyzed"
},
"attributes.stock_take_type": {
"type": "string",
"index": "not_analyzed"
},
"attributes.wid": {
"type": "string",
"index": "not_analyzed"
},
"client_id": {
"type": "string",
"index": "not_analyzed"
},
"createdAtEpoch": {
"type": "long"
},
"facility_id": {
"type": "string",
"index": "not_analyzed"
},
"id": {
"type": "string",
"index": "not_analyzed"
},
"resources.id": {
"type": "string",
"index": "not_analyzed"
},
"resources.type": {
"type": "string",
"index": "not_analyzed"
},
"status": {
"type": "string",
"index": "not_analyzed"
},
"tenant_id": {
"type": "string",
"index": "not_analyzed"
},
"updatedAtEpoch": {
"type": "long"
}
}
},
"id": {
"type": "string",
"index": "not_analyzed"
},
"tenant": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
This is the _delete_by_query
that I am using to delete all documents that have the value of "A" for facility_id
{
"query": {
"query_string": {
"query": "A",
"default_field": "facility_id"
}
}
}
The same payload returns 600 documents for _search
API
Where am I going wrong?
Upvotes: 1
Views: 262
Reputation: 16943
I think _delete_by_query
wasn't available in ver 1.7.
The correct way to delete by query would in your case be
curl -XDELETE 'http://xyz:9200/index_name/composite_task_group/_query' -d '{
"query" : {
...
}
}
'
The error you're seeing is typically thrown when you're inserting a new document to an index that required types, thus trying to update its mapping but that mapping is optionally prohibited from being dynamically updated, hence the statement "dynamic mapping is disabled".
Upvotes: 1