Deleting ElasticSearch record - apoc.es.delete

I am looking into integrating the use of the apoc.es functions to help manage ElasticSearch indexes. I see there are several apoc.es functions that should allow creating new and updating existing ElasticSearch indexes.

Has anyone done anything with deleting ElasticSearch indexing? Based on the current way stuff is getting done, being able to delete would be especially helpful. My aim is to configure the ES indexing to run as part of the ETL process.

This problem is based on a restructuring of our ETL process and was trying to see if this could be done using just cypher initially. I'm curious to get other insights on how people approach managing ElasticSearch indexes with their graph. One caveat to this issue is that the environment in which I am working isn't something that makes it easy to add a new tool or product to help out. That being said, any insight on how others tackle this problem is welcome.

So i think I came up with a decent solution that works within the constraints of my project environment...

Every node in the graph has a unique uuid value. During the query to delete a particular node we can pass in an empty option {} to the Elastic Search index using the apoc.es.put since we can pass in that particular node's uuid to update the ES index. After the query is run every node that gets deleted has its respective ES index set as an empty object, {}. Then, using curl and the Delete by query API we match every object from that index where the designated required property, uuid, does not exist and delete the those index objects.

I have done some initial testing on the concept and it seems to work pretty darn well. So I figured I would share in case others encounter an issue like this.