2

I wish to delete all the percolator queries on an index, but leave the documents intact.

Is there an easy way to perform this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
GlennJ
  • 167
  • 7

3 Answers3

3

Meanwhile this is fixed. The following command will delete all the percoaltor queries:

curl -XDELETE 'localhost:9200/my-index/.percolator/_query' -d '{
    "query" : {
        "match_all" : {}
    }
}'
Kiran
  • 203
  • 2
  • 3
  • 13
1

Percolator is special type with name .percolator in your index.

Every query registered in percolator is just a document in this type.

Knowing this fact, you can delete all queries from percolator like this:

$client = new Elastica\Client();
$index = $client->getIndex('myindex');
$percolator = $index->getType('.percolator');
$percolator->delete();
Igor Denisenko
  • 254
  • 2
  • 7
0

It seems like you should be able to use delete-by-query and the match-all query on the .percolator type of the index. This does not work and is a long-reported ES bug (see here and then here).

The next best solution is to run a query against the .percolator type and then loop over the results, deleting each percolator document individually.

(Edited because initial answer was wrong.)

skillet-thief
  • 549
  • 4
  • 8