[Answer]-Failed to add documents to Solr: [Reason: Error 400 [doc=null] missing required field: site_id]

1👍

Kudos goes to Alexandre Rafalovitch who’s comment pointed me into the right direction.

It turns out that supervisor starts and stops solr without reporting any errors. When I started solr manually, I would see that it cannot be started because the port was taken.

That means, unknowingly I left out the most important information: I was working on a shared hosting environment, where another user had already setup his own solr instance.

In order to further verify that I made sure that supervisor and “my” solr instance were stopped. Then I ran

curl http://localhost:8983/solr

And I got a response.

Now things were easy. I changed the port in

~/opt/apache-solr-3.5.0/example/etc/jetty.xml

to 8984 and in the local_settings.py of my Django project I added the following:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
        'URL': 'http://127.0.0.1:8984/solr'
    },
}

Et voila. Now I can rebuild my index again.

Leave a comment