Uploading nested JSON objects to Solr

南笙酒味 提交于 2020-01-06 07:41:15

问题


I'm trying to send my inline JSON file to my Solr Database, but I'm having a problem with my nested objects.

I have two nested objects inside my _source object which are media_gallery and stock. Before my upload used to crash, but I managed to upload it after a few corrections, but my media_gallery and stock are added as separate objects therefore instead of having the original 1000 objects I get 3000 objects in my Solr DB after my upload.

I'm currently using this command to upload my JSON file:

curl 'http://192.168.99.100:8983/solr/gettingstarted/update/json/docs?split=/_source/media_gallery|/_source/stock&commit=true' \
     --data-binary @catalog.json \
     -H 'Content-type:application/json'

Basically I'm uploading the file catalog.json to http://192.168.99.100:8983/solr/gettingstarted.

My media_gallery and stock are both objects inside an object named _source and they're getting split as separate ones.

Could anyone help me with this? I need my media_gallery and stock objects to be uploaded as objects inside my source object one and not as a few separate ones.

Thank you.

Solution:

Basically there was no need for splitting the nested objects. Since i'm uploading everything as a single Solr document therefor i can use the the path "/".

curl 'http://192.168.99.100:8983/solr/gettingstarted/update/json/docs?split=&commit=true' --data-binary @catalog.json -H 'Content-type:application/json'

回答1:


You should change your split param (remove /_source/media_gallery & /_source/stock)

If the entire JSON makes a single Solr document, the path must be “/” Solr Guide: json mapping-parameters



来源:https://stackoverflow.com/questions/51628295/uploading-nested-json-objects-to-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!