Re: Delete in Solr based on foreign key (like SQL delete from … where id in (select id from…)
Absolutely, using Mikhail's code would be the first thing I would do. You can see the details in SOLR-6234 and https://github.com/m-khl/lucene-join-solr-query-parser Otherwise, the only alternative I can think of (without reindexing) would be to run the select query as provided, returning the ID's of the offending documents (for reference, you could use grouping or the collapsing query parser if you just want to get distinct values; faceting is also an option). Then write a script to iterate through a batch of ID's at a time and send a delete to Solr, such as deletequeryid:(100 OR 101 OR ...)/query/delete. Since there are many documents to delete, you would want to hold off committing until the end. On 11 October 2014 02:34, Mikhail Khludnev mkhlud...@griddynamics.com wrote: On Fri, Oct 10, 2014 at 6:16 AM, Matthew Nigl matthew.n...@gmail.com wrote: But I get the same response as in https://issues.apache.org/jira/browse/SOLR-6357 there is a mention for cure (SOLR-6234 https://issues.apache.org/jira/browse/SOLR-6234) over there -- Sincerely yours Mikhail Khludnev Principal Engineer, Grid Dynamics http://www.griddynamics.com mkhlud...@griddynamics.com
Re: Delete in Solr based on foreign key (like SQL delete from … where id in (select id from…)
Hi matthew, I'm more than glad getting the ids and deleting them in a separate query, if need be. But how do I do it? It's dozens of thousands of ids that I have to delete. What's the strategy to delete them? On Fri, Oct 10, 2014 at 4:16 AM, Matthew Nigl matthew.n...@gmail.com wrote: I was going to say that the below should do what you are asking: deletequery{!join from=docid_s to=foreign_key_docid_s}(message_state_ts:[* TO 2014-10-05T00:00:00Z} AND message_state_ts:{2014-10-01T00:00:00Z TO *])/query/delete But I get the same response as in https://issues.apache.org/jira/browse/SOLR-6357 I can't think of any other queries at the moment. You might consider using the above query (which should work as a normal select query) to get the IDs, then delete them in a separate query. On 10 October 2014 07:31, Luis Festas Matos lufe...@gmail.com wrote: Given the following Solr data: doc str name=index_id1008rs1cz0icl2pk/str date name=message_state_ts2014-10-07T14:18:29.784Z/date str name=docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421448900608/long/doc I would like to know how to *DELETE documents* above on the Solr console or using a script that achieves the same result as issuing the following statement in SQL (assuming all of these columns existed in a table called x ): DELETE FROM x WHERE foreign_key_docid_s in (select docid_s from x where message_state_ts '2014-10-05' and message_state_ts '2014-10-01') Basically, delete all derived documents whose foreign key is the same as the primary key where the primary key is selected between 2 dates. Question originally posted on stackoverflow.com - http://stackoverflow.com/questions/26248372/delete-in-solr-based-on-foreign-key-like-sql-delete-from-where-id-in-selec
Re: Delete in Solr based on foreign key (like SQL delete from … where id in (select id from…)
On Fri, Oct 10, 2014 at 6:16 AM, Matthew Nigl matthew.n...@gmail.com wrote: But I get the same response as in https://issues.apache.org/jira/browse/SOLR-6357 there is a mention for cure (SOLR-6234 https://issues.apache.org/jira/browse/SOLR-6234) over there -- Sincerely yours Mikhail Khludnev Principal Engineer, Grid Dynamics http://www.griddynamics.com mkhlud...@griddynamics.com
Delete in Solr based on foreign key (like SQL delete from … where id in (select id from…)
Given the following Solr data: doc str name=index_id1008rs1cz0icl2pk/str date name=message_state_ts2014-10-07T14:18:29.784Z/date str name=docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421448900608/long/doc I would like to know how to *DELETE documents* above on the Solr console or using a script that achieves the same result as issuing the following statement in SQL (assuming all of these columns existed in a table called x ): DELETE FROM x WHERE foreign_key_docid_s in (select docid_s from x where message_state_ts '2014-10-05' and message_state_ts '2014-10-01') Basically, delete all derived documents whose foreign key is the same as the primary key where the primary key is selected between 2 dates. Question originally posted on stackoverflow.com - http://stackoverflow.com/questions/26248372/delete-in-solr-based-on-foreign-key-like-sql-delete-from-where-id-in-selec
Re: Delete in Solr based on foreign key (like SQL delete from … where id in (select id from…)
I was going to say that the below should do what you are asking: deletequery{!join from=docid_s to=foreign_key_docid_s}(message_state_ts:[* TO 2014-10-05T00:00:00Z} AND message_state_ts:{2014-10-01T00:00:00Z TO *])/query/delete But I get the same response as in https://issues.apache.org/jira/browse/SOLR-6357 I can't think of any other queries at the moment. You might consider using the above query (which should work as a normal select query) to get the IDs, then delete them in a separate query. On 10 October 2014 07:31, Luis Festas Matos lufe...@gmail.com wrote: Given the following Solr data: doc str name=index_id1008rs1cz0icl2pk/str date name=message_state_ts2014-10-07T14:18:29.784Z/date str name=docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421768716288/long/docdoc str name=index_idu42xyz1cz0i7sx87/str str name=foreign_key_docid_sh60fmtybz0i7sx87/str long name=_version_1481314421448900608/long/doc I would like to know how to *DELETE documents* above on the Solr console or using a script that achieves the same result as issuing the following statement in SQL (assuming all of these columns existed in a table called x ): DELETE FROM x WHERE foreign_key_docid_s in (select docid_s from x where message_state_ts '2014-10-05' and message_state_ts '2014-10-01') Basically, delete all derived documents whose foreign key is the same as the primary key where the primary key is selected between 2 dates. Question originally posted on stackoverflow.com - http://stackoverflow.com/questions/26248372/delete-in-solr-based-on-foreign-key-like-sql-delete-from-where-id-in-selec