{"id":741,"date":"2020-03-23T04:12:02","date_gmt":"2020-03-23T04:12:02","guid":{"rendered":"https:\/\/www.aeologic.com\/blog\/?p=741"},"modified":"2020-03-23T04:12:02","modified_gmt":"2020-03-23T04:12:02","slug":"all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide","status":"publish","type":"post","link":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/","title":{"rendered":"All About Indexing and Basic Data Operations &#8211; Part 4 &#8211; Ultimate Solr Guide"},"content":{"rendered":"<p>Hello, Everyone! Today we are here with another post to further our discussion about basic indexing operations in solr.\u00a0 Another basic need one faces in the indexed doc in solr is to change the doc contents. Solr supports three approaches to update a document with varied necessity.<\/p>\n<div class=\"post-header\">\n<h1 class=\"post-title-main\">Updating Parts of Documents<\/h1>\n<p>The first is\u00a0<em><a href=\"https:\/\/lucene.apache.org\/solr\/guide\/7_4\/updating-parts-of-documents.html#atomic-updates\">atomic updates<\/a><\/em>. This approach allows changing only one or more fields of a document without having to re-index the entire document.<\/p>\n<p>The second approach is known as\u00a0<em><a href=\"https:\/\/lucene.apache.org\/solr\/guide\/7_4\/updating-parts-of-documents.html#in-place-updates\">in-place updates<\/a><\/em>. This approach is similar to atomic updates (is a subset of atomic updates in some sense), but can be used only for updating single valued non-indexed and non-stored docValue-based numeric fields.<\/p>\n<p>The third approach is known as\u00a0<em><a href=\"https:\/\/lucene.apache.org\/solr\/guide\/7_4\/updating-parts-of-documents.html#optimistic-concurrency\">optimistic concurrency<\/a><\/em>\u00a0or\u00a0<em>optimistic locking<\/em>. It is a feature of many NoSQL databases, and allows conditional updating a document based on its version. This approach includes semantics and rules for how to deal with version matches or mis-matches.<\/p>\n<div id=\"preamble\">\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Atomic Updates (and in-place updates) and Optimistic Concurrency may be used as independent strategies for managing changes to documents, or they may be combined: you can use optimistic concurrency to conditionally apply an atomic update.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"atomic-updates\" class=\"clickable-header top-level-header\">Atomic Updates<\/h2>\n<p>Solr supports several modifiers that atomically update values of a document. This allows updating only specific fields, which can help speed indexing processes in an environment where speed of index additions is critical to the application.<\/p>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>To use atomic updates, add a modifier to the field that needs to be updated. The content can be updated, added to, or incrementally increased if the field has a numeric type.<\/p>\n<\/div>\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\"><code>set<\/code><\/dt>\n<dd>Set or replace the field value(s) with the specified value(s), or remove the values if &#8216;null&#8217; or empty list is specified as the new value.<\/p>\n<div class=\"paragraph\">\n<p>May be specified as a single value, or as a list for multiValued fields.<\/p>\n<\/div>\n<\/dd>\n<dt class=\"hdlist1\"><code>add<\/code><\/dt>\n<dd>Adds the specified values to a multiValued field. May be specified as a single value, or as a list.<\/dd>\n<dt class=\"hdlist1\"><code>add-distinct<\/code><\/dt>\n<dd>Adds the specified values to a multiValued field, only if not already present. May be specified as a single value, or as a list.<\/dd>\n<dt class=\"hdlist1\"><code>remove<\/code><\/dt>\n<dd>Removes (all occurrences of) the specified values from a multiValued field. May be specified as a single value, or as a list.<\/dd>\n<dt class=\"hdlist1\"><code>removeregex<\/code><\/dt>\n<dd>Removes all occurrences of the specified regex from a multiValued field. May be specified as a single value, or as a list.<\/dd>\n<dt class=\"hdlist1\"><code>inc<\/code><\/dt>\n<dd>Increments a numeric value by a specific amount. Must be specified as a single numeric value.<\/dd>\n<\/dl>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"field-storage\" class=\"clickable-header\">Field Storage<\/h3>\n<div class=\"paragraph\">\n<p>The core functionality of atomically updating a document requires that all fields in your schema must be configured as stored (<code>stored=\"true\"<\/code>) or docValues (<code>docValues=\"true\"<\/code>) except for fields which are\u00a0<code>&lt;copyField\/&gt;<\/code>\u00a0destinations, which must be configured as\u00a0<code>stored=\"false\"<\/code>. Atomic updates are applied to the document represented by the existing stored field values. All data in copyField destinations fields must originate from ONLY copyField sources.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>If\u00a0<code>&lt;copyField\/&gt;<\/code>\u00a0destinations are configured as stored, then Solr will attempt to index both the current value of the field as well as an additional copy from any source fields. If such fields contain some information that comes from the indexing program and some information that comes from copyField, then the information which originally came from the indexing program will be lost when an atomic update is made.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>There are other kinds of derived fields that must also be set so they aren\u2019t stored. Some spatial field types, such as BBoxField and LatLonType, use derived fields. CurrencyFieldType also uses derived fields. These types create additional fields which are normally specified by a dynamic field definition. That dynamic field definition must be not stored, or indexing will fail.<\/p>\n<\/div>\n<h3 id=\"example-updating-part-of-a-document\" class=\"clickable-header\">Example Updating Part of a Document<\/h3>\n<div class=\"paragraph\">\n<p>If the following document exists in our collection:<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-743\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86.png\" alt=\"\" width=\"555\" height=\"331\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86.png 555w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86-300x179.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86-260x155.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86-134x80.png 134w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-86-250x149.png 250w\" sizes=\"(max-width: 555px) 100vw, 555px\" \/><\/p>\n<p>And we apply the following update command:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-744\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87.png\" alt=\"\" width=\"549\" height=\"338\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87.png 1076w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-300x185.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-768x473.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-1024x630.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-720x443.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-260x160.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-130x80.png 130w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-87-250x154.png 250w\" sizes=\"(max-width: 549px) 100vw, 549px\" \/><\/p>\n<p>The resulting document in our collection will be:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-745\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88.png\" alt=\"\" width=\"545\" height=\"290\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88.png 1176w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-300x160.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-768x409.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-1024x545.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-720x383.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-260x138.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-150x80.png 150w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-88-250x133.png 250w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"post-content\">\n<div id=\"toc\" class=\"toc toc-normal\">\n<h2 id=\"in-place-updates\" class=\"clickable-header top-level-header\">In-Place Updates<\/h2>\n<p>&nbsp;<\/p>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>In-place updates are very similar to atomic updates; in some sense, this is a subset of atomic updates. In regular atomic updates, the entire document is re-indexed internally during the application of the update. However, in this approach, only the fields to be updated are affected and the rest of the documents are not re-indexed internally. Hence, the efficiency of updating in-place is unaffected by the size of the documents that are updated (i.e., number of fields, size of fields, etc.). Apart from these internal differences, there is no functional difference between atomic updates and in-place updates.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>An atomic update operation is performed using this approach only when the fields to be updated meet these three conditions:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>are non-indexed (<code>indexed=\"false\"<\/code>), non-stored (<code>stored=\"false\"<\/code>), single valued (<code>multiValued=\"false\"<\/code>) numeric docValues (<code>docValues=\"true\"<\/code>) fields;<\/li>\n<li>the\u00a0<code>_version_<\/code>\u00a0field is also a non-indexed, non-stored single valued docValues field; and,<\/li>\n<li>copy targets of updated fields, if any, are also non-indexed, non-stored single valued numeric docValues fields.<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>To use in-place updates, add a modifier to the field that needs to be updated. The content can be updated or incrementally increased.<\/p>\n<\/div>\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\"><code>set<\/code><\/dt>\n<dd>Set or replace the field value(s) with the specified value(s). May be specified as a single value.<\/dd>\n<dt class=\"hdlist1\"><code>inc<\/code><\/dt>\n<dd>Increments a numeric value by a specific amount. Must be specified as a single numeric value.<\/dd>\n<\/dl>\n<\/div>\n<div class=\"sect2\">\n<h2 id=\"optimistic-concurrency\" class=\"clickable-header top-level-header\">Optimistic Concurrency<\/h2>\n<p>&nbsp;<\/p>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Optimistic Concurrency is a feature of Solr that can be used by client applications which update\/replace documents to ensure that the document they are replacing\/updating has not been concurrently modified by another client application. This feature works by requiring a\u00a0<code>_version_<\/code>\u00a0field on all documents in the index, and comparing that to a\u00a0<code>_version_<\/code>\u00a0specified as part of the update command. By default, Solr\u2019s Schema includes a\u00a0<code>_version_<\/code>\u00a0field, and this field is automatically added to each new document.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>In general, using optimistic concurrency involves the following work flow:<\/p>\n<\/div>\n<div class=\"olist arabic\">\n<ol class=\"arabic\">\n<li>A client reads a document. In Solr, one might retrieve the document with the\u00a0<code>\/get<\/code>\u00a0handler to be sure to have the latest version.<\/li>\n<li>A client changes the document locally.<\/li>\n<li>The client resubmits the changed document to Solr, for example, perhaps with the\u00a0<code>\/update<\/code>\u00a0handler.<\/li>\n<li>If there is a version conflict (HTTP error code 409), the client starts the process over.<\/li>\n<\/ol>\n<\/div>\n<div class=\"paragraph\">\n<p>When the client resubmits a changed document to Solr, the\u00a0<code>_version_<\/code>\u00a0can be included with the update to invoke optimistic concurrency control. Specific semantics are used to define when the document should be updated or when to report a conflict.<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>If the content in the\u00a0<code>_version_<\/code>\u00a0field is greater than &#8216;1&#8217; (i.e., &#8216;12345&#8217;), then the\u00a0<code>_version_<\/code>\u00a0in the document must match the\u00a0<code>_version_<\/code>\u00a0in the index.<\/li>\n<li>If the content in the\u00a0<code>_version_<\/code>\u00a0field is equal to &#8216;1&#8217;, then the document must simply exist. In this case, no version matching occurs, but if the document does not exist, the updates will be rejected.<\/li>\n<li>If the content in the\u00a0<code>_version_<\/code>\u00a0field is less than &#8216;0&#8217; (i.e., &#8216;-1&#8217;), then the document must\u00a0<strong>not<\/strong>\u00a0exist. In this case, no version matching occurs, but if the document exists, the updates will be rejected.<\/li>\n<li>If the content in the\u00a0<code>_version_<\/code>\u00a0field is equal to &#8216;0&#8217;, then it doesn\u2019t matter if the versions match or if the document exists or not. If it exists, it will be overwritten; if it does not exist, it will be added.<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>If the document being updated does not include the\u00a0<code>_version_<\/code>\u00a0field, and atomic updates are not being used, the document will be treated by normal Solr rules, which is usually to discard the previous version.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>When using Optimistic Concurrency, clients can include an optional\u00a0<code>versions=true<\/code>\u00a0request parameter to indicate that the\u00a0<em>new<\/em>\u00a0versions of the documents being added should be included in the response. This allows clients to immediately know what the\u00a0<code>_version_<\/code>\u00a0is of every document added without needing to make a redundant\u00a0<a href=\"https:\/\/lucene.apache.org\/solr\/guide\/7_4\/realtime-get.html#realtime-get\"><code>\/get<\/code>\u00a0request<\/a>.<\/p>\n<p>Following are some examples using\u00a0<code>versions=true<\/code>\u00a0in queries:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-746\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89.png\" alt=\"\" width=\"682\" height=\"172\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89.png 2048w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-300x76.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-768x194.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-1024x259.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-720x182.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-1180x298.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-260x66.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-316x80.png 316w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-89-250x63.png 250w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-747\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90.png\" alt=\"\" width=\"554\" height=\"269\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90.png 992w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-300x146.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-768x373.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-720x350.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-260x126.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-165x80.png 165w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-90-250x121.png 250w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/p>\n<p>In this example, we have added 2 documents &#8220;ddd&#8221; and &#8220;eee&#8221;. Because we added <code>versions=true<\/code>\u00a0to the request, the response shows the document version for each document.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-748\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91.png\" alt=\"\" width=\"706\" height=\"178\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91.png 2048w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-300x76.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-768x194.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-1024x259.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-720x182.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-1180x298.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-260x66.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-316x80.png 316w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-91-250x63.png 250w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-749\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92.png\" alt=\"\" width=\"661\" height=\"182\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92.png 1750w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-300x83.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-768x212.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-1024x282.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-720x198.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-1180x325.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-260x72.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-290x80.png 290w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-92-250x69.png 250w\" sizes=\"(max-width: 661px) 100vw, 661px\" \/><\/p>\n<p>In this example, we\u2019ve attempted to update document &#8220;ddd&#8221; but specified the wrong version in the request: <code><em>version<\/em>=999999<\/code>\u00a0doesn\u2019t match the document version we just got when we added the document. We get an error in response.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-750\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93.png\" alt=\"\" width=\"678\" height=\"171\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93.png 2048w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-300x76.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-768x194.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-1024x259.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-720x182.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-1180x298.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-260x66.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-316x80.png 316w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-93-250x63.png 250w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-751\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94.png\" alt=\"\" width=\"544\" height=\"245\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94.png 992w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-300x135.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-768x345.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-720x324.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-260x117.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-178x80.png 178w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/03\/carbon-94-250x112.png 250w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/p>\n<p>Now we\u2019ve sent an update with a value for\u00a0<code>_version_<\/code>\u00a0that matches the value in the index, and it succeeds. Because we included\u00a0<code>versions=true<\/code>\u00a0to the update request, the response includes a different value for the\u00a0<code>_version_<\/code>\u00a0field.<\/p>\n<p>So, this is it about today. Stay tuned for another post very soon.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello, Everyone! Today we are here with another post to further our discussion about basic indexing operations in solr.\u00a0 Another basic need one faces in the indexed doc in solr is to change the doc contents. Solr supports three approaches to update a document with varied necessity. Updating Parts of Documents The first is\u00a0atomic updates. This approach allows changing only one or more fields of a document without having to re-index the entire document. The second approach is known as\u00a0in-place updates. This approach is similar to atomic updates (is a subset of atomic updates in some sense), but can be used only for updating single valued non-indexed and non-stored docValue-based numeric fields. The third approach is known as\u00a0optimistic concurrency\u00a0or\u00a0optimistic locking. It is a feature of many NoSQL databases, and allows conditional updating a document based on its version. This approach includes semantics and rules for how to deal with version matches or mis-matches. Atomic Updates (and in-place updates) and Optimistic Concurrency may be used as independent strategies for managing changes to documents, or they may be combined: you can use optimistic concurrency to conditionally apply an atomic update. Atomic Updates Solr supports several modifiers that atomically update values of a document. This allows updating only specific fields, which can help speed indexing processes in an environment where speed of index additions is critical to the application. To use atomic updates, add a modifier to the field that needs to be updated. The content can be updated, added to, or incrementally increased if the field has a numeric type. set Set or replace the field value(s) with the specified value(s), or remove the values if &#8216;null&#8217; or empty list is specified as the new value. May be specified as a single value, or as a list for multiValued fields. add Adds the specified values to a multiValued field. May be specified as a single value, or as a list. add-distinct Adds the specified values to a multiValued field, only if not already present. May be specified as a single value, or as a list. remove Removes (all occurrences of) the specified values from a multiValued field. May be specified as a single value, or as a list. removeregex Removes all occurrences of the specified regex from a multiValued field. May be specified as a single value, or as a list. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Field Storage The core functionality of atomically updating a document requires that all fields in your schema must be configured as stored (stored=&#8221;true&#8221;) or docValues (docValues=&#8221;true&#8221;) except for fields which are\u00a0&lt;copyField\/&gt;\u00a0destinations, which must be configured as\u00a0stored=&#8221;false&#8221;. Atomic updates are applied to the document represented by the existing stored field values. All data in copyField destinations fields must originate from ONLY copyField sources. If\u00a0&lt;copyField\/&gt;\u00a0destinations are configured as stored, then Solr will attempt to index both the current value of the field as well as an additional copy from any source fields. If such fields contain some information that comes from the indexing program and some information that comes from copyField, then the information which originally came from the indexing program will be lost when an atomic update is made. There are other kinds of derived fields that must also be set so they aren\u2019t stored. Some spatial field types, such as BBoxField and LatLonType, use derived fields. CurrencyFieldType also uses derived fields. These types create additional fields which are normally specified by a dynamic field definition. That dynamic field definition must be not stored, or indexing will fail. Example Updating Part of a Document If the following document exists in our collection: And we apply the following update command: The resulting document in our collection will be: In-Place Updates &nbsp; In-place updates are very similar to atomic updates; in some sense, this is a subset of atomic updates. In regular atomic updates, the entire document is re-indexed internally during the application of the update. However, in this approach, only the fields to be updated are affected and the rest of the documents are not re-indexed internally. Hence, the efficiency of updating in-place is unaffected by the size of the documents that are updated (i.e., number of fields, size of fields, etc.). Apart from these internal differences, there is no functional difference between atomic updates and in-place updates. An atomic update operation is performed using this approach only when the fields to be updated meet these three conditions: are non-indexed (indexed=&#8221;false&#8221;), non-stored (stored=&#8221;false&#8221;), single valued (multiValued=&#8221;false&#8221;) numeric docValues (docValues=&#8221;true&#8221;) fields; the\u00a0_version_\u00a0field is also a non-indexed, non-stored single valued docValues field; and, copy targets of updated fields, if any, are also non-indexed, non-stored single valued numeric docValues fields. To use in-place updates, add a modifier to the field that needs to be updated. The content can be updated or incrementally increased. set Set or replace the field value(s) with the specified value(s). May be specified as a single value. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Optimistic Concurrency &nbsp; Optimistic Concurrency is a feature of Solr that can be used by client applications which update\/replace documents to ensure that the document they are replacing\/updating has not been concurrently modified by another client application. This feature works by requiring a\u00a0_version_\u00a0field on all documents in the index, and comparing that to a\u00a0_version_\u00a0specified as part of the update command. By default, Solr\u2019s Schema includes a\u00a0_version_\u00a0field, and this field is automatically added to each new document. In general, using optimistic concurrency involves the following work flow: A client reads a document. In Solr, one might retrieve the document with the\u00a0\/get\u00a0handler to be sure to have the latest version. A client changes the document locally. The client resubmits the changed document to Solr, for example, perhaps with the\u00a0\/update\u00a0handler. If there is a version conflict (HTTP error code 409), the client starts the process over. When the client resubmits a changed document to Solr, the\u00a0_version_\u00a0can be included with the update to invoke [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":635,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-741","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solr"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog\" \/>\n<meta property=\"og:description\" content=\"Hello, Everyone! Today we are here with another post to further our discussion about basic indexing operations in solr.\u00a0 Another basic need one faces in the indexed doc in solr is to change the doc contents. Solr supports three approaches to update a document with varied necessity. Updating Parts of Documents The first is\u00a0atomic updates. This approach allows changing only one or more fields of a document without having to re-index the entire document. The second approach is known as\u00a0in-place updates. This approach is similar to atomic updates (is a subset of atomic updates in some sense), but can be used only for updating single valued non-indexed and non-stored docValue-based numeric fields. The third approach is known as\u00a0optimistic concurrency\u00a0or\u00a0optimistic locking. It is a feature of many NoSQL databases, and allows conditional updating a document based on its version. This approach includes semantics and rules for how to deal with version matches or mis-matches. Atomic Updates (and in-place updates) and Optimistic Concurrency may be used as independent strategies for managing changes to documents, or they may be combined: you can use optimistic concurrency to conditionally apply an atomic update. Atomic Updates Solr supports several modifiers that atomically update values of a document. This allows updating only specific fields, which can help speed indexing processes in an environment where speed of index additions is critical to the application. To use atomic updates, add a modifier to the field that needs to be updated. The content can be updated, added to, or incrementally increased if the field has a numeric type. set Set or replace the field value(s) with the specified value(s), or remove the values if &#8216;null&#8217; or empty list is specified as the new value. May be specified as a single value, or as a list for multiValued fields. add Adds the specified values to a multiValued field. May be specified as a single value, or as a list. add-distinct Adds the specified values to a multiValued field, only if not already present. May be specified as a single value, or as a list. remove Removes (all occurrences of) the specified values from a multiValued field. May be specified as a single value, or as a list. removeregex Removes all occurrences of the specified regex from a multiValued field. May be specified as a single value, or as a list. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Field Storage The core functionality of atomically updating a document requires that all fields in your schema must be configured as stored (stored=&quot;true&quot;) or docValues (docValues=&quot;true&quot;) except for fields which are\u00a0&lt;copyField\/&gt;\u00a0destinations, which must be configured as\u00a0stored=&quot;false&quot;. Atomic updates are applied to the document represented by the existing stored field values. All data in copyField destinations fields must originate from ONLY copyField sources. If\u00a0&lt;copyField\/&gt;\u00a0destinations are configured as stored, then Solr will attempt to index both the current value of the field as well as an additional copy from any source fields. If such fields contain some information that comes from the indexing program and some information that comes from copyField, then the information which originally came from the indexing program will be lost when an atomic update is made. There are other kinds of derived fields that must also be set so they aren\u2019t stored. Some spatial field types, such as BBoxField and LatLonType, use derived fields. CurrencyFieldType also uses derived fields. These types create additional fields which are normally specified by a dynamic field definition. That dynamic field definition must be not stored, or indexing will fail. Example Updating Part of a Document If the following document exists in our collection: And we apply the following update command: The resulting document in our collection will be: In-Place Updates &nbsp; In-place updates are very similar to atomic updates; in some sense, this is a subset of atomic updates. In regular atomic updates, the entire document is re-indexed internally during the application of the update. However, in this approach, only the fields to be updated are affected and the rest of the documents are not re-indexed internally. Hence, the efficiency of updating in-place is unaffected by the size of the documents that are updated (i.e., number of fields, size of fields, etc.). Apart from these internal differences, there is no functional difference between atomic updates and in-place updates. An atomic update operation is performed using this approach only when the fields to be updated meet these three conditions: are non-indexed (indexed=&quot;false&quot;), non-stored (stored=&quot;false&quot;), single valued (multiValued=&quot;false&quot;) numeric docValues (docValues=&quot;true&quot;) fields; the\u00a0_version_\u00a0field is also a non-indexed, non-stored single valued docValues field; and, copy targets of updated fields, if any, are also non-indexed, non-stored single valued numeric docValues fields. To use in-place updates, add a modifier to the field that needs to be updated. The content can be updated or incrementally increased. set Set or replace the field value(s) with the specified value(s). May be specified as a single value. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Optimistic Concurrency &nbsp; Optimistic Concurrency is a feature of Solr that can be used by client applications which update\/replace documents to ensure that the document they are replacing\/updating has not been concurrently modified by another client application. This feature works by requiring a\u00a0_version_\u00a0field on all documents in the index, and comparing that to a\u00a0_version_\u00a0specified as part of the update command. By default, Solr\u2019s Schema includes a\u00a0_version_\u00a0field, and this field is automatically added to each new document. In general, using optimistic concurrency involves the following work flow: A client reads a document. In Solr, one might retrieve the document with the\u00a0\/get\u00a0handler to be sure to have the latest version. A client changes the document locally. The client resubmits the changed document to Solr, for example, perhaps with the\u00a0\/update\u00a0handler. If there is a version conflict (HTTP error code 409), the client starts the process over. When the client resubmits a changed document to Solr, the\u00a0_version_\u00a0can be included with the update to invoke [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Aeologic Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AeoLogicTech\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-23T04:12:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"622\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Manoj Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@aeologictech\" \/>\n<meta name=\"twitter:site\" content=\"@aeologictech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manoj Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\"},\"author\":{\"name\":\"Manoj Kumar\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4\"},\"headline\":\"All About Indexing and Basic Data Operations &#8211; Part 4 &#8211; Ultimate Solr Guide\",\"datePublished\":\"2020-03-23T04:12:02+00:00\",\"dateModified\":\"2020-03-23T04:12:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\"},\"wordCount\":1374,\"publisher\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png\",\"articleSection\":[\"Solr\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\",\"url\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\",\"name\":\"All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png\",\"datePublished\":\"2020-03-23T04:12:02+00:00\",\"dateModified\":\"2020-03-23T04:12:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage\",\"url\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png\",\"contentUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png\",\"width\":1080,\"height\":622},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.aeologic.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"All About Indexing and Basic Data Operations &#8211; Part 4 &#8211; Ultimate Solr Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#website\",\"url\":\"https:\/\/www.aeologic.com\/blog\/\",\"name\":\"Aeologic Blog\",\"description\":\"Aeologic\",\"publisher\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.aeologic.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\",\"name\":\"AeoLogic Technologies\",\"url\":\"https:\/\/www.aeologic.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg\",\"contentUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg\",\"width\":385,\"height\":162,\"caption\":\"AeoLogic Technologies\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/AeoLogicTech\/\",\"https:\/\/x.com\/aeologictech\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4\",\"name\":\"Manoj Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g\",\"caption\":\"Manoj Kumar\"},\"description\":\"Manoj Kumar is a seasoned Digital Marketing Manager and passionate Tech Blogger with deep expertise in SEO, AI trends, and emerging digital technologies. He writes about innovative solutions that drive growth and transformation across industry. Featured on - YOURSTORY | TECHSLING | ELEARNINGINDUSTRY | DATASCIENCECENTRAL | TIMESOFINDIA | MEDIUM | DATAFLOQ\",\"sameAs\":[\"https:\/\/www.aeologic.com\/\",\"https:\/\/www.linkedin.com\/in\/manoj-kumar-rajput\/\"],\"url\":\"https:\/\/www.aeologic.com\/blog\/author\/manoj\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/","og_locale":"en_US","og_type":"article","og_title":"All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog","og_description":"Hello, Everyone! Today we are here with another post to further our discussion about basic indexing operations in solr.\u00a0 Another basic need one faces in the indexed doc in solr is to change the doc contents. Solr supports three approaches to update a document with varied necessity. Updating Parts of Documents The first is\u00a0atomic updates. This approach allows changing only one or more fields of a document without having to re-index the entire document. The second approach is known as\u00a0in-place updates. This approach is similar to atomic updates (is a subset of atomic updates in some sense), but can be used only for updating single valued non-indexed and non-stored docValue-based numeric fields. The third approach is known as\u00a0optimistic concurrency\u00a0or\u00a0optimistic locking. It is a feature of many NoSQL databases, and allows conditional updating a document based on its version. This approach includes semantics and rules for how to deal with version matches or mis-matches. Atomic Updates (and in-place updates) and Optimistic Concurrency may be used as independent strategies for managing changes to documents, or they may be combined: you can use optimistic concurrency to conditionally apply an atomic update. Atomic Updates Solr supports several modifiers that atomically update values of a document. This allows updating only specific fields, which can help speed indexing processes in an environment where speed of index additions is critical to the application. To use atomic updates, add a modifier to the field that needs to be updated. The content can be updated, added to, or incrementally increased if the field has a numeric type. set Set or replace the field value(s) with the specified value(s), or remove the values if &#8216;null&#8217; or empty list is specified as the new value. May be specified as a single value, or as a list for multiValued fields. add Adds the specified values to a multiValued field. May be specified as a single value, or as a list. add-distinct Adds the specified values to a multiValued field, only if not already present. May be specified as a single value, or as a list. remove Removes (all occurrences of) the specified values from a multiValued field. May be specified as a single value, or as a list. removeregex Removes all occurrences of the specified regex from a multiValued field. May be specified as a single value, or as a list. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Field Storage The core functionality of atomically updating a document requires that all fields in your schema must be configured as stored (stored=\"true\") or docValues (docValues=\"true\") except for fields which are\u00a0&lt;copyField\/&gt;\u00a0destinations, which must be configured as\u00a0stored=\"false\". Atomic updates are applied to the document represented by the existing stored field values. All data in copyField destinations fields must originate from ONLY copyField sources. If\u00a0&lt;copyField\/&gt;\u00a0destinations are configured as stored, then Solr will attempt to index both the current value of the field as well as an additional copy from any source fields. If such fields contain some information that comes from the indexing program and some information that comes from copyField, then the information which originally came from the indexing program will be lost when an atomic update is made. There are other kinds of derived fields that must also be set so they aren\u2019t stored. Some spatial field types, such as BBoxField and LatLonType, use derived fields. CurrencyFieldType also uses derived fields. These types create additional fields which are normally specified by a dynamic field definition. That dynamic field definition must be not stored, or indexing will fail. Example Updating Part of a Document If the following document exists in our collection: And we apply the following update command: The resulting document in our collection will be: In-Place Updates &nbsp; In-place updates are very similar to atomic updates; in some sense, this is a subset of atomic updates. In regular atomic updates, the entire document is re-indexed internally during the application of the update. However, in this approach, only the fields to be updated are affected and the rest of the documents are not re-indexed internally. Hence, the efficiency of updating in-place is unaffected by the size of the documents that are updated (i.e., number of fields, size of fields, etc.). Apart from these internal differences, there is no functional difference between atomic updates and in-place updates. An atomic update operation is performed using this approach only when the fields to be updated meet these three conditions: are non-indexed (indexed=\"false\"), non-stored (stored=\"false\"), single valued (multiValued=\"false\") numeric docValues (docValues=\"true\") fields; the\u00a0_version_\u00a0field is also a non-indexed, non-stored single valued docValues field; and, copy targets of updated fields, if any, are also non-indexed, non-stored single valued numeric docValues fields. To use in-place updates, add a modifier to the field that needs to be updated. The content can be updated or incrementally increased. set Set or replace the field value(s) with the specified value(s). May be specified as a single value. inc Increments a numeric value by a specific amount. Must be specified as a single numeric value. Optimistic Concurrency &nbsp; Optimistic Concurrency is a feature of Solr that can be used by client applications which update\/replace documents to ensure that the document they are replacing\/updating has not been concurrently modified by another client application. This feature works by requiring a\u00a0_version_\u00a0field on all documents in the index, and comparing that to a\u00a0_version_\u00a0specified as part of the update command. By default, Solr\u2019s Schema includes a\u00a0_version_\u00a0field, and this field is automatically added to each new document. In general, using optimistic concurrency involves the following work flow: A client reads a document. In Solr, one might retrieve the document with the\u00a0\/get\u00a0handler to be sure to have the latest version. A client changes the document locally. The client resubmits the changed document to Solr, for example, perhaps with the\u00a0\/update\u00a0handler. If there is a version conflict (HTTP error code 409), the client starts the process over. When the client resubmits a changed document to Solr, the\u00a0_version_\u00a0can be included with the update to invoke [&hellip;]","og_url":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/","og_site_name":"Aeologic Blog","article_publisher":"https:\/\/www.facebook.com\/AeoLogicTech\/","article_published_time":"2020-03-23T04:12:02+00:00","og_image":[{"width":1080,"height":622,"url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png","type":"image\/png"}],"author":"Manoj Kumar","twitter_card":"summary_large_image","twitter_creator":"@aeologictech","twitter_site":"@aeologictech","twitter_misc":{"Written by":"Manoj Kumar","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#article","isPartOf":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/"},"author":{"name":"Manoj Kumar","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4"},"headline":"All About Indexing and Basic Data Operations &#8211; Part 4 &#8211; Ultimate Solr Guide","datePublished":"2020-03-23T04:12:02+00:00","dateModified":"2020-03-23T04:12:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/"},"wordCount":1374,"publisher":{"@id":"https:\/\/www.aeologic.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png","articleSection":["Solr"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/","url":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/","name":"All About Indexing and Basic Data Operations - Part 4 - Ultimate Solr Guide - Aeologic Blog","isPartOf":{"@id":"https:\/\/www.aeologic.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png","datePublished":"2020-03-23T04:12:02+00:00","dateModified":"2020-03-23T04:12:02+00:00","breadcrumb":{"@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#primaryimage","url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png","contentUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Indexing-and-Basic-Data-Operations.png","width":1080,"height":622},{"@type":"BreadcrumbList","@id":"https:\/\/www.aeologic.com\/blog\/all-about-indexing-and-basic-data-operations-part-4-ultimate-solr-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.aeologic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"All About Indexing and Basic Data Operations &#8211; Part 4 &#8211; Ultimate Solr Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.aeologic.com\/blog\/#website","url":"https:\/\/www.aeologic.com\/blog\/","name":"Aeologic Blog","description":"Aeologic","publisher":{"@id":"https:\/\/www.aeologic.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.aeologic.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.aeologic.com\/blog\/#organization","name":"AeoLogic Technologies","url":"https:\/\/www.aeologic.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg","contentUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg","width":385,"height":162,"caption":"AeoLogic Technologies"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/AeoLogicTech\/","https:\/\/x.com\/aeologictech"]},{"@type":"Person","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4","name":"Manoj Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g","caption":"Manoj Kumar"},"description":"Manoj Kumar is a seasoned Digital Marketing Manager and passionate Tech Blogger with deep expertise in SEO, AI trends, and emerging digital technologies. He writes about innovative solutions that drive growth and transformation across industry. Featured on - YOURSTORY | TECHSLING | ELEARNINGINDUSTRY | DATASCIENCECENTRAL | TIMESOFINDIA | MEDIUM | DATAFLOQ","sameAs":["https:\/\/www.aeologic.com\/","https:\/\/www.linkedin.com\/in\/manoj-kumar-rajput\/"],"url":"https:\/\/www.aeologic.com\/blog\/author\/manoj\/"}]}},"_links":{"self":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts\/741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/comments?post=741"}],"version-history":[{"count":0,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts\/741\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/media\/635"}],"wp:attachment":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/media?parent=741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/categories?post=741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/tags?post=741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}