使用http get方法更新solr文档

时间:2017-09-27 20:11:49

标签: solr updates

使用curl这可以通过以下方式完成:(更新价格字段值为100)

curl http://localhost:8983/solr/update?commit=true' -H 'Content-type:application/json' -d '[{"id":"1","price":{"set":100}}] 

如何使用http get方法做​​同样的事情?我需要在下面填写XXXX:

http://localhost:8983/solr/mycore/update?stream.body=XXXX&commit=true

以下不起作用:

http://localhost:8983/solr/mycore/update?stream.body=<add><doc><field name="id">1</field><field name="price" update="set">100</field></doc></add>&commit=true

1 个答案:

答案 0 :(得分:2)

stream.body不需要是xml,所以这可行:

http://localhost:8983/solr/mycore/update?stream.body=[{"id":"1","price":{"set":100}}]&commit=true