11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$ curl -X POST -H 'Content-Type: application/json'<br />

'http://localhost:8983/solr/techproducts/update?versions=true' --data-binary '<br />

[ { "id" : "aaa" },<br />

{ "id" : "bbb" } ]'<br />

{"responseHeader":{"status":0,"QTime":6},<br />

"adds":["aaa",1498562471222312960,<br />

"bbb",1498562471225458688]}<br />

$ curl -X POST -H 'Content-Type: application/json'<br />

'http://localhost:8983/solr/techproducts/update?_version_=999999&versions=true'<br />

--data-binary '<br />

[{ "id" : "aaa",<br />

"foo_s" : "update attempt with wrong existing version" }]'<br />

{"responseHeader":{"status":409,"QTime":3},<br />

"error":{"msg":"version conflict for aaa expected=999999<br />

actual=1498562471222312960",<br />

"code":409}}<br />

$ curl -X POST -H 'Content-Type: application/json'<br />

'http://localhost:8983/solr/techproducts/update?_version_=1498562471222312960&versio<br />

ns=true&commit=true' --data-binary '<br />

[{ "id" : "aaa",<br />

"foo_s" : "update attempt with correct existing version" }]'<br />

{"responseHeader":{"status":0,"QTime":5},<br />

"adds":["aaa",1498562624496861184]}<br />

$ curl 'http://localhost:8983/solr/techproducts/query?q=*:*&fl=id,_version_'<br />

{<br />

"responseHeader":{<br />

"status":0,<br />

"QTime":5,<br />

"params":{<br />

"fl":"id,_version_",<br />

"q":"*:*"}},<br />

"response":{"numFound":2,"start":0,"docs":[<br />

{<br />

"id":"bbb",<br />

"_version_":1498562471225458688},<br />

{<br />

"id":"aaa",<br />

"_version_":1498562624496861184}]<br />

}}<br />

For more information, please also see Yonik Seeley's presentation on NoSQL features in <strong>Solr</strong> 4 from <strong>Apache</strong><br />

Lucene EuroCon 2012.<br />

Power Tip<br />

The _version_ field is by default stored in the inverted index ( indexed="true" ). However, for some<br />

systems with a very large number of documents, the increase in FieldCache memory requirements may<br />

be too costly. A solution can be to declare the _version_ field as DocValues:<br />

Sample field definition<br />

<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

229

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!