lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "UpdateJSON" by YonikSeeley
Date Tue, 07 Dec 2010 22:06:28 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "UpdateJSON" page has been changed by YonikSeeley.
The comment on this change is: give examples of different update commands.
http://wiki.apache.org/solr/UpdateJSON?action=diff&rev1=1&rev2=2

--------------------------------------------------

  JSON formatted update requests may be sent to Solr via the /solr/update/json URL.
  All of the normal methods for [[ContentStream|uploading content]] are supported.
  
- === Example ===
+ == Example ==
  There is a sample JSON file at {{{example/exampledocs/books.json}}} that may be used to
add documents to the solr example server.
  
  Example of using HTTP-POST to index the JSON:
@@ -73, +73 @@

  }'
  curl "$URL?commit=true"
  }}}
+ == Update Commands ==
+ The JSON update handler accepts all of the types of update commands that the XML update
handler supports, through a straightforward mapping.
+ Please see the [[UpdateXmlMessages|documentation on XML updates]] for detailed descriptions
of the commands.
  
+ Multiple commands may be contained in one message.
+ Here is an example JSON update message demonstrating multiple update commands (note: comments
are not legal JSON)
+ {{{
+ { 
+ "add": {
+   "doc": {
+     "id": "DOC1",
+     "my_boosted_field": {        /* use a map with boost/value for a boosted field */
+       "boost": 2.3,
+       "value": "test"
+     },
+     "my_multivalued_field": [ "aaa", "bbb" ],  /* use an array for a multi-valued field
*/
+   }
+ },
+ "add": {
+   "commitWithin": 5000,          /* commit this document within 5 seconds */
+   "overwrite": false,            /* don't check for existing documents with the same uniqueKey
*/
+   "boost": 3.45,                 /* a document boost */
+   "doc": {
+     "f1": "v1",
+     "f1": "v2"
+   }
+ },
+ 
+ "commit": {},
+ "optimize": { "waitFlush":false, "waitSearcher":false },
+ 
+ "delete": { "id":"ID" },         /* delete by ID */
+ "delete": { "query":"QUERY" },   /* delete by query */
+ }
+ }}}
+ 
+ Just as in the other update handlers, parameters such as commit, commitWithin, optimize,
and overwrite may be specified in the URL instead of in the body of the message.
+ 

Mime
View raw message