<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Foreach Processor(循環處理器) 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/foreach-processor.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/foreach-processor.html) 譯文鏈接 : [http://www.apache.wiki/display/Elasticsearch](http://www.apache.wiki/display/Elasticsearch) 貢獻者 : [那伊抹微笑](/display/~wangyangting),[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) 提示 : 由于該 **Foreach Processor** 的功能是 **experimental**(實驗性的),所以暫不翻譯,保留原文。 [experimental] Processes elements in an array of unknown length. All processors can operate on elements inside an array, but if all elements of an array need to be processed in the same way, defining a processor for each element becomes cumbersome and tricky because it is likely that the number of elements in an array is unknown. For this reason the?`foreach`processor exists. By specifying the field holding array elements and a processor that defines what should happen to each element, array fields can easily be preprocessed. A processor inside the foreach processor works in the array element context and puts that in the ingest metadata under the?`_ingest._value`?key. If the array element is a json object it holds all immediate fields of that json object. and if the nested object is a value is?`_ingest._value`?just holds that value. Note that if a processor prior to the?`foreach`?processor used?`_ingest._value`?key then the specified value will not be available to the processor inside the?`foreach`?processor. The?`foreach`processor does restore the original value, so that value is available to processors after the?`foreach`processor. Note that any other field from the document are accessible and modifiable like with all other processors. This processor just puts the current array element being read into?`_ingest._value`ingest metadata attribute, so that it may be pre-processed. If the?`foreach`?processor fails to process an element inside the array, and no?`on_failure`?processor has been specified, then it aborts the execution and leaves the array unmodified. ## Table?19.?Foreach Options | Name | Required | Default | Description | | --- | --- | --- | --- | | `field` | yes | - | The array field | | `processor` | yes | - | The processor to execute against each field | Assume the following document: ``` { "values" : ["foo", "bar", "baz"] } ``` When this?`foreach`?processor operates on this sample document: ``` { "foreach" : { "field" : "values", "processor" : { "uppercase" : { "field" : "_ingest._value" } } } } ``` Then the document will look like this after preprocessing: ``` { "values" : ["FOO", "BAR", "BAZ"] } ``` Let’s take a look at another example: ``` { "persons" : [ { "id" : "1", "name" : "John Doe" }, { "id" : "2", "name" : "Jane Doe" } ] } ``` In this case, the?`id`?field needs to be removed, so the following?`foreach`?processor is used: ``` { "foreach" : { "field" : "persons", "processor" : { "remove" : { "field" : "_ingest._value.id" } } } } ``` After preprocessing the result is: ``` { "persons" : [ { "name" : "John Doe" }, { "name" : "Jane Doe" } ] } ``` The wrapped processor can have a?`on_failure`?definition. For example, the?`id`?field may not exist on all person objects. Instead of failing the index request, you can use an?`on_failure`?block to send the document to the?_failure_index_?index for later inspection: ``` { "foreach" : { "field" : "persons", "processor" : { "remove" : { "field" : "_value.id", "on_failure" : [ { "set" : { "field", "_index", "value", "failure_index" } } ] } } } } ``` In this example, if the?`remove`?processor does fail, then the array elements that have been processed thus far will be updated. Another advanced example can be found in the?[attachment processor documentation](https://www.elastic.co/guide/en/elasticsearch/plugins/5.3/ingest-attachment-with-arrays.html).
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看