On Mon, Jun 18, 2012 at 5:03 PM, Kai Gülzau <kguel...@novomind.com> wrote: > I'm currently playing around with a branch 4x Version > (https://builds.apache.org/job/Solr-4.x/5/) but I don't get field updates to > work. > > A simple GET testrequest > http://localhost:8983/solr/master/update/json?stream.body={"add":{"doc":{"ukey":"08154711","type":"1","nbody":{"set":"mycontent"}}}} > > results in > { > "ukey":"08154711", > "type":"1", > "nbody":"{set=mycontent}"}] > } > > All fields are stored. > ukey is the unique key :-) > type is a required field. > nbody is a solr.TextField.
With the Solr example (4.x), the following seems to work: URL=http://localhost:8983/solr/update curl $URL?commit=true -H 'Content-type:application/json' -d '{ "add": { "doc": { "id": "id", "title": "test", "price_f": 10 }}}' curl $URL?commit=true -H 'Content-type:application/json' -d '{ "add": { "doc": { "id": "id", "price_f": {"set": 5}}}}' If you are using solrj then there's a junit test method, testUpdateField(), that does something similar: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?view=markup -- Sami Siren