Hi all, We're using the JSON update handler and we're currently doing two seperate, but related updates. The first is a deleteByQuery to delete a bunch of documents, the second then is a new set of documents to replace the old. The premise is that the documents are all related in some way and there might be additions or deletions to the set of related documents.
I don't know if we have a problem with solr per se, but we do have instances where some of the documents are not searchable after an "update." I say "update" because it could be our process for sending the documents that is the problem. Nevertheless, I'd like to commit the deleteByQuery and the update of the set of documents in one transaction with solr, especially since the two commits are going to invalidate search readers on each. Since we use the JSON update handler, I went to the wiki and found this example: { "add": { "doc": { "id": "DOC1", "my_boosted_field": { /* use a map with boost/value for a boosted field */ "boost": 2.3, "value": "test" }, "my_multivalued_field": [ "aaa", "bbb" ] /* use an array for a multi-valued field */ } }, "add": { "commitWithin": 5000, /* commit this document within 5 seconds */ "overwrite": false, /* don't check for existing documents with the same uniqueKey */ "boost": 3.45, /* a document boost */ "doc": { "f1": "v1", "f1": "v2" } }, "commit": {}, "optimize": { "waitFlush":false, "waitSearcher":false }, "delete": { "id":"ID" }, /* delete by ID */ "delete": { "query":"QUERY" } /* delete by query */ "delete": { "query":"QUERY", 'commitWithin':'500' } /* delete by query, commit within 500ms */ } The problem I have is that JSON is not specified to preserve order of keys. What I want to do is: { "delete": { "query":"QUERY" }, "add": [{ "doc": { "id": "DOC1", "my_boosted_field": { /* use a map with boost/value for a boosted field */ "boost": 2.3, "value": "test" }, "my_multivalued_field": [ "aaa", "bbb" ] /* use an array for a multi-valued field */ } }, { "commitWithin": 5000, /* commit this document within 5 seconds */ "overwrite": false, /* don't check for existing documents with the same uniqueKey */ "boost": 3.45, /* a document boost */ "doc": { "f1": "v1", "f1": "v2" } }], "commit": {} } But how do I guarantee that the "delete" comes before the "add" and that the "commit" comes after everything? Is it possible to put the delete in a separate JSON object, but first in the HTTP POST request (and then put the commit in the url)? Thanks for any help! Cheers, Craig