github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/processors/select_parts.md (about) 1 --- 2 title: select_parts 3 type: processor 4 status: stable 5 categories: ["Utility"] 6 --- 7 8 <!-- 9 THIS FILE IS AUTOGENERATED! 10 11 To make changes please edit the contents of: 12 lib/processor/select_parts.go 13 --> 14 15 import Tabs from '@theme/Tabs'; 16 import TabItem from '@theme/TabItem'; 17 18 19 Cherry pick a set of messages from a batch by their index. Indexes larger than 20 the number of messages are simply ignored. 21 22 23 <Tabs defaultValue="common" values={[ 24 { label: 'Common', value: 'common', }, 25 { label: 'Advanced', value: 'advanced', }, 26 ]}> 27 28 <TabItem value="common"> 29 30 ```yaml 31 # Common config fields, showing default values 32 label: "" 33 select_parts: {} 34 ``` 35 36 </TabItem> 37 <TabItem value="advanced"> 38 39 ```yaml 40 # All config fields, showing default values 41 label: "" 42 select_parts: 43 parts: 44 - 0 45 ``` 46 47 </TabItem> 48 </Tabs> 49 50 The selected parts are added to the new message batch in the same order as the 51 selection array. E.g. with 'parts' set to [ 2, 0, 1 ] and the message parts 52 [ '0', '1', '2', '3' ], the output will be [ '2', '0', '1' ]. 53 54 If none of the selected parts exist in the input batch (resulting in an empty 55 output message) the batch is dropped entirely. 56 57 Message indexes can be negative, and if so the part will be selected from the 58 end counting backwards starting from -1. E.g. if index = -1 then the selected 59 part will be the last part of the message, if index = -2 then the part before 60 the last element with be selected, and so on. 61 62 The functionality of this processor depends on being applied across messages 63 that are batched. You can find out more about batching [in this doc](/docs/configuration/batching). 64 65 ## Fields 66 67 ### `parts` 68 69 An optional array of message indexes of a batch that the processor should apply to. 70 If left empty all messages are processed. This field is only applicable when 71 batching messages [at the input level](/docs/configuration/batching). 72 73 Indexes can be negative, and if so the part will be selected from the end 74 counting backwards starting from -1. 75 76 77 Type: `array` 78 Default: `[0]` 79 80