使用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
答案 0 :(得分:2)
stream.body不需要是xml,所以这可行:
http://localhost:8983/solr/mycore/update?stream.body=[{"id":"1","price":{"set":100}}]&commit=true