I have the following Nest request to delete all relevant documents, quite simply, but I get 400 bad requests.
var client = new ElasticClient(); var request = new DeleteByQueryRequest<Type>("my-index") { Query = new QueryContainer( new TermQuery { Field = "versionId", Value = "ea8e517b-c2e3-4dfe-8e49-edc8bda67bad" } ) }; var response = client.DeleteByQuery(request); Assert.IsTrue(response.IsValid);
Thanks for any help.
--------------- Update ---------------
Request body
{"query":{"term":{"versionId":{"value":"ea8e517b-c2e3-4dfe-8e49-edc8bda67bad"}}}}
Reaction body
{"took":0,"timed_out":false,"_indices":{"_all":{"found":0,"deleted":0,"missing":0,"failed":0}},"failures":[]}
Query in Sense Plugin:
GET /my-index/type/_search { "query": { "match": { "versionId": "ea8e517b-c2e3-4dfe-8e49-edc8bda67bad" } } }
Response to the request:
{ "took": 3, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 116, "max_score": 2.1220484, "hits": [] ... }}
--------------- NEST QUERY --------------
DELETE http://localhost:9200/my-index/component/_query?pretty=true { "query": { "term": { "versionId": { "value": "ea8e517b-c2e3-4dfe-8e49-edc8bda67bad" } } } } Status: 200 { "took" : 0, "timed_out" : false, "_indices" : { "_all" : { "found" : 0, "deleted" : 0, "missing" : 0, "failed" : 0 } }, "failures" : [ ] }
Chirdeep tomar
source share