AttributeError: 'Search' object has no attribute 'delete'
See original GitHub issue`from elasticsearch import Elasticsearch from elasticsearch_dsl import Search
client = Elasticsearch() s = Search(using=client) s = s.using(client) s = Search().using(client).query(“match”, title=“python”) response = s.execute() for hit in s: print(hit.title)
response = s.delete()`
after executing this code i have got the error AttributeError: ‘Search’ object has no attribute ‘delete’
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
AttributeError: 'Key' object has no attribute 'delete'
According to the source code of the library, you can use the delete function for that purpose: it accepts the key of the...
Read more >object has no attribute 'delete' - Google Groups
Hi all,. I'm trying migrate from 0.3 to 0.6. I don't know how to delete an object. in the old version it was:...
Read more >AttributeError at /map/ 'NoneType' object has no attribute 'delete'
Hi, inside my urls.py file I have the following code: from django.urls import path from . import views urlpatterns = [ path('map/', views....
Read more >AttributeError: 'str' object has no attribute 'remove' | bobbyhadz
The Python "AttributeError: 'str' object has no attribute 'remove'" occurs when we try to call the remove() method on a string instead of...
Read more >Search DSL — Elasticsearch DSL 7.2.0 documentation
You can delete the documents matching a search by calling delete on the Search object ... If you already have a query object,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are some errors in your code. First you’re repeating yourself with all the using client, therefore I would suggest to you to use configure connections method for that so you don’t always specify the client on each search object. Regardless, the first attempt should work. Then you’re trying to delete a response which is not possible, you have to call a delete request on the query like you would do with the rest APIs of elasticsearch. After that you’re iterating s ichi is the search object and not the response. I have adjusted your code for different purposes since I don’t know what you were trying to do and I modified the query in a more dsl way.
@roshnikasliwal can you also specify which version of
elasticsearch-dsl
you are using?Search.delete()
was added in5.2
. Thank you