Skip to content

al-serebrov/es-delete-by-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

For newer versions of ElasticSearch (> 5.0) there's such functionality "out of the box", check the official documentation here

But for older versions (< 5.0), for example for 2.4, you can use this simple python script to perform delete by query.

Installation

The script depends only on official ElasticSearch python client

Make the following steps to install needed requirements into isolated virtual environment:

virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

Script takes settings via command line arguments:

$ python delete_by_query.py --help
usage: delete_by_query.py [-h] [-i INDEX] [-t DOC_TYPE]

Delete documents from ElasticSearch by query.

optional arguments:
  -h, --help            show this help message and exit
  -i INDEX, --index INDEX
                        Index name, defaults to index
  -t DOC_TYPE, --type DOC_TYPE
                        Document type, defaults to document

To change the query used to find (and then delete) documents you need to go ahead and change the source code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published