Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most simple way (URL?) to trigger SOLR commit of all pending docs?

Tags:

solr

What's the most simple way to cause a SOLR installation to commit all pending docs?

(There's no obvious way in the admin interface. There's a script called 'commit' mentioned on the page http://wiki.apache.org/solr/SolrOperationsTools -- but no hint where that lives. 'Commit' is clearly an option that can be added to any update POST, but I can't find any reference to a single URL that serves to only commit.)

like image 622
gojomo Avatar asked Oct 19 '11 01:10

gojomo


4 Answers

THIS HOLDS FOR SOLR VERSIONS < 5.0

Try [solr url]/update?commit=true

For example, with an URL like the SOLR example defaults, from the same machine, http://localhost:8983/solr/update?commit=true should do it.

FOR SOLR VERSIONS >= 5.0
http://localhost:8983/solr/[collection_name]/update?commit=true

like image 186
Itay Moav -Malimovka Avatar answered Nov 05 '22 07:11

Itay Moav -Malimovka


Since Solr 5 it is required to add collection name into the url, so now the right answer is:

http://localhost:8983/solr/collection_name/update?commit=true

In the previous versions it was possible to have a default collection (it was usually collection1, from the examples) and the shortened version was valid:

http://localhost:8983/solr/update?commit=true

Still, it was possible to name the collection like in the first case.

like image 36
mickythump Avatar answered Nov 05 '22 07:11

mickythump


I would say there is something missing in "right" answer - URL should contain collection name like: http://localhost:8983/solr/mycollection/update?commit=true

like image 8
dr_leevsey Avatar answered Nov 05 '22 09:11

dr_leevsey


I know this is an old thread, but just to say that there is also a way to do this via the admin interface.

Simply click:

-> dataimport on the left menu

-> then tick the commit checkbox

-> then execute

You will see a message like: "Indexing completed. Added/Updated: 1 documents. Deleted 0 documents. (Duration: 01s)"

like image 1
Bast Avatar answered Nov 05 '22 08:11

Bast