-
Notifications
You must be signed in to change notification settings - Fork 801
Search.delete needs to handle kwargs #1115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can always call Hope this helps! |
@honzakral I tried the above the solution but it does not seem to help. def unindex(_id, index):
query = unindex_query(_id)
s = Search(index=index).query(Q(query))
# For travis tests to pass
s.params(conflicts='proceed')
s.delete() query looks something like this - query = {'match': {'_id': 'test123'}} (Pdb) Q(query)
Match(_id='test123') Is there something wrong the way I have Implemented? ES version and elasticsearch_dsl_version 6.6 |
you need to assign back to |
@honzakral The above solution is something like, skipping the deletion operation if I am correct because the record does not gets deleted rather it creates a duplicate one. Have a look at screenshot - Ideally, the total record should have been empty because there will be a tearDown after every test. Also the _id values should not have been more than 3 if its deleting everything in tearDown. |
@honzakral @shivam05011996 I am facing similar problem. Before I go ahead and rely on
|
The preferred way of passing parameters to `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic#1115 and elastic#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `scan` method to the most recent versions since they were 404ing.
… links The preferred way of passing parameters to `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic#1115 and elastic#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `Search.scan` and `FacetedSearch.params` methods to the most recent versions since they were 404ing.
The preferred way of passing parameters to the DSL `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic/elasticsearch-dsl-py#1115 and elastic/elasticsearch-dsl-py#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `Search.scan` and `FacetedSearch.params` methods to the most recent versions since they were 404ing.
… links (#2861) * Add param notes to DSL search.delete documentation, fix broken links The preferred way of passing parameters to the DSL `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic/elasticsearch-dsl-py#1115 and elastic/elasticsearch-dsl-py#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `Search.scan` and `FacetedSearch.params` methods to the most recent versions since they were 404ing. * make sync and async changes the same --------- Co-authored-by: Luna Lucadou <[email protected]> Co-authored-by: Miguel Grinberg <[email protected]>
… links (#2861) * Add param notes to DSL search.delete documentation, fix broken links The preferred way of passing parameters to the DSL `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic/elasticsearch-dsl-py#1115 and elastic/elasticsearch-dsl-py#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `Search.scan` and `FacetedSearch.params` methods to the most recent versions since they were 404ing. * make sync and async changes the same --------- Co-authored-by: Luna Lucadou <[email protected]> Co-authored-by: Miguel Grinberg <[email protected]> (cherry picked from commit b6d1211)
… links (#2861) (#2869) * Add param notes to DSL search.delete documentation, fix broken links The preferred way of passing parameters to the DSL `Search.delete` appears to be calling `Search.params` first, but this is only ever discussed in GitHub issues like elastic/elasticsearch-dsl-py#1115 and elastic/elasticsearch-dsl-py#1395. To help anyone else who has stumbled across this, I added a note about this to the documentation. I also went ahead and updated the links for the `Search.scan` and `FacetedSearch.params` methods to the most recent versions since they were 404ing. * make sync and async changes the same --------- Co-authored-by: Luna Lucadou <[email protected]> Co-authored-by: Miguel Grinberg <[email protected]> (cherry picked from commit b6d1211) Co-authored-by: Luna Lucadou <[email protected]>
Search.delete does not take in keywords, such as conflicts=proceed, which is essential when trying to delete multiple objects, but currently the issue returned is:
ConflictError(409, u'{"took":1,"timed_out":false,"total":2,"deleted":0,"batches":1,"version_conflicts":2,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[{"index":"mlsdata_test","type":"doc","id":"DlyKuWgBOtcMH22wMIjN","cause":{"type":"version_conflict_engine_exception","reason":"[doc][DlyKuWgBOtcMH22wMIjN]: version conflict, current version [2] is different than the one provided [1]","index_uuid":"YY-DGvIkSe6bGSQsobnYCA","shard":"0","index":"mlsdata_test"},"status":409},{"index":"mlsdata_test","type":"doc","id":"D1yKuWgBOtcMH22wMIjv","cause":{"type":"version_conflict_engine_exception","reason":"[doc][D1yKuWgBOtcMH22wMIjv]: version conflict, current version [2] is different than the one provided [1]","index_uuid":"YY-DGvIkSe6bGSQsobnYCA","shard":"0","index":"mlsdata_test"},"status":409}]}')
Traceback (most recent call last):
File "", line 186, in upsert_json_mls_listing_to_document
File "", line 147, in handle_previously_matched_record
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch_dsl.zip/elasticsearch_dsl/search.py", line 742, in delete
**self._params
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch.zip/elasticsearch/client/utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch.zip/elasticsearch/client/init.py", line 886, in delete_by_query
doc_type, '_delete_by_query'), params=params, body=body)
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch.zip/elasticsearch/transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch.zip/elasticsearch/connection/http_requests.py", line 90, in perform_request
self._raise_error(response.status_code, raw_data)
File "/mnt/yarn/usercache/livy/appcache/application_1548450731252_0176/spark-eb780ca6-de11-4c8f-a6d1-449f4b5c3168/userFiles-2fa51379-ad00-48df-a497-ede1424836b5/elasticsearch.zip/elasticsearch/connection/base.py", line 125, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
ConflictError: ConflictError(409, u'{"took":1,"timed_out":false,"total":2,"deleted":0,"batches":1,"version_conflicts":2,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[{"index":"mlsdata_test","type":"doc","id":"DlyKuWgBOtcMH22wMIjN","cause":{"type":"version_conflict_engine_exception","reason":"[doc][DlyKuWgBOtcMH22wMIjN]: version conflict, current version [2] is different than the one provided [1]","index_uuid":"YY-DGvIkSe6bGSQsobnYCA","shard":"0","index":"mlsdata_test"},"status":409},{"index":"mlsdata_test","type":"doc","id":"D1yKuWgBOtcMH22wMIjv","cause":{"type":"version_conflict_engine_exception","reason":"[doc][D1yKuWgBOtcMH22wMIjv]: version conflict, current version [2] is different than the one provided [1]","index_uuid":"YY-DGvIkSe6bGSQsobnYCA","shard":"0","index":"mlsdata_test"},"status":409}]}')
The text was updated successfully, but these errors were encountered: