It's simple in Elasticsearch, but what you actually get is a single
document and all it's children data ({state, price}) entries are
joined together behind the scenes into the multivalued fields. Which
may or may not be an issue for you.

For Solr, nested documents need to be parent/child separate documents.
And the syntax is a bit more explicit. So, you can either provide more
explicit JSON:
https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-NestedChildDocuments

or transform JSON document before mapping it to the Solr schema:
http://lucidworks.com/blog/indexing-custom-json-data/ (latest 4.10 Solr).

Regards,
   Alex.
Personal: http://www.outerthoughts.com/ and @arafalov
Solr resources and newsletter: http://www.solr-start.com/ and @solrstart
Solr popularizers community: https://www.linkedin.com/groups?gid=6713853


On 15 November 2014 17:05, David Lee <seek...@gmail.com> wrote:
> Hi All,
>
> How do I index complex JSON data in SOLR? For example,
>
> {prices:[{state:"CA", price:"101.0"}, {state:"NJ",
> price:"102.0"},{state:"CO", price:"102.0"}]}
>
>
> It's simple in ElasticSearch, but in SOLR it always reports the following
> error:
> "Error parsing JSON field value. Unexpected OBJECT_START"
>
>
> Thanks,
> DL

Reply via email to