Bulk-add percolator queries


(Eric Landry) #1

I want to throw my many documents to a LOT of percolator queries (my query count is in the 6-digit). I've found how to multi-percolate many documents at once, but haven't found how to bulk-add many queries at once.

Any ideas?


(Eric Landry) #2

According to the documentation, I can register a query in the percolator using:

curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
    "query" : {
        "match" : {
            "message" : "bonsai tree"
        }
    }
}'

Can I add many of these in one fell swoop?


(Eric Landry) #3

I've set a bounty on SO, if that can motivate anybody :thumbsup:


(Colin Goodheart-Smithe) #4

Why not use the _bulk API (https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html) and set the index as my-index the type as .percolator and the body as the query?

I haven't actually tried this out but I imagine it should work given that you can register percolator queries using the standard index API

HTH


(Eric Landry) #5

That worked! Thanks!!!


(system) #6