image-match icon indicating copy to clipboard operation
image-match copied to clipboard

Add method to remove images from index

Open walidsa3d opened this issue 8 years ago • 4 comments

Please can you add a method to remove an image from the index, I would like to keep the index up-to-date with my list of images (which is constantly changing).

walidsa3d avatar May 04 '17 13:05 walidsa3d

Hey @walidsa3d

Should be easy to implement, see https://github.com/pavlovai/match/blob/master/src/match/server.py#L43

rhsimplex avatar May 08 '17 09:05 rhsimplex

Page not found - Could you please reiterate how to remove images from the index, and also possible functions I can use with ses?

bhavikshah1995 avatar Feb 21 '19 16:02 bhavikshah1995

#108

bhavikshah1995 avatar Feb 22 '19 19:02 bhavikshah1995

#108 would delete an entire index I think @walidsa3d want's to delete a single image. I also think this is out of the scope of image-match. Adding and searching images need wrappers since it deals with the signature algorithm. Try this:

from elasticsearch import Elasticsearch
es = Elasticsearch()
IMAGE_NAME = 'my_awesome_image.jpg'
query = f'path:"{IMAGE_NAME}"'
es.delete_by_query(index='images', doc_type='image', body={}, q=query)

The doc_type and index parameters are set by image-match here.

Additionally, I set the body param to an empty object as the method requires it but I am using the uri search query instead of using the body.

Resources: Using Elasticsearch's delete by query elasticsearch-py's method delete_by_query

taylorjdawson avatar Feb 22 '19 20:02 taylorjdawson