Delete document when not in specified indexes

Is there a way, using delete by query, to delete all documents that
are not in certain indexes?

So I might have a bunch of documents

http://localhost:9200/index1/mytype/1
http://localhost:9200/index2/mytype/1
http://localhost:9200/index3/mytype/1
http://localhost:9200/index4/mytype/1
...
http://localhost:9200/index99/mytype/1

... and I want to execute a query that deletes document 1, of type
"mytype", when it's not in index3 or index4. Is that possible without
also storing the index as another term in the document itself?

... and I want to execute a query that deletes document 1, of type
"mytype", when it's not in index3 or index4. Is that possible without
also storing the index as another term in the document itself?

You would need to index the _index value, which you can enable in the
mapping:

clint

One option is to execute the delete against all indices, except for index3
and index4.

On Wed, Nov 9, 2011 at 3:22 AM, Kunal cvkunal@gmail.com wrote:

Is there a way, using delete by query, to delete all documents that
are not in certain indexes?

So I might have a bunch of documents

http://localhost:9200/index1/mytype/1
http://localhost:9200/index2/mytype/1
http://localhost:9200/index3/mytype/1
http://localhost:9200/index4/mytype/1
...
http://localhost:9200/index99/mytype/1

... and I want to execute a query that deletes document 1, of type
"mytype", when it's not in index3 or index4. Is that possible without
also storing the index as another term in the document itself?