Reputation: 41
Good day everyone.
I recently faced a problem. I've got a bunch of documents for indexing. The problem, that they in the same time a database for another application. These documents stored in JSON format in the following scheme:
{ "id": 10, "name": "dad 177", "cat":[{ "id":254, "name":"124" }] }
When I'm trying to post them, I get the following error:
ERROR org.apache.solr.core.SolrCore – org.apache.solr.common.SolrException: Unknown command: id [8]
Is there a way to index these documents without changing ? How can i modify the schema or I need to do something else ? I'm quite new in Solr, could you help me ?
Upvotes: 2
Views: 1972
Reputation: 22555
I can see from your JSON example, is that you have an embedded object for the cat
property. The error you are receiving, I am pretty sure, is related to the id
property of the nested object for your cat
property.
Unfortunately, Solr does not support nested documents at this time, so I do not think you will be able to index these documents without changing them. You could perhaps write some code in the language of your choice to parse the JSON documents, removing the nested objects and passing them into Solr using one of the supported libraries listed in Solr Client Libraries / Language Bindings
For reference, here is the guidance from the Solr Wiki on Updating a Solr Index with JSON.
Upvotes: 2