Skip to content

Commit 078a367

Browse files
vagimelinatebower
andauthored
[DOC] Add join processor documentation (#5985)
* Add join processor documentation Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Add examples and explanatory text Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Address tech review comments Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> * Update _ingest-pipelines/processors/join.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: Melissa Vagi <vagimeli@amazon.com> --------- Signed-off-by: Melissa Vagi <vagimeli@amazon.com> Co-authored-by: Nathan Bower <nbower@amazon.com>
1 parent 69f9cf0 commit 078a367

File tree

1 file changed

+135
-0
lines changed
  • _ingest-pipelines/processors

1 file changed

+135
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
layout: default
3+
title: Join
4+
parent: Ingest processors
5+
nav_order: 160
6+
---
7+
8+
# Join processor
9+
10+
The `join` processor concatenates the elements of an array into a single string value, using a specified separator between each element. It throws an exception if the provided input is not an array.
11+
12+
The following is the syntax for the `join` processor:
13+
14+
```json
15+
{
16+
"join": {
17+
"field": "field_name",
18+
"separator": "separator_string"
19+
}
20+
}
21+
```
22+
{% include copy-curl.html %}
23+
24+
## Configuration parameters
25+
26+
The following table lists the required and optional parameters for the `join` processor.
27+
28+
Parameter | Required/Optional | Description |
29+
|-----------|-----------|-----------|
30+
`field` | Required | The name of the field to which the join operator is applied. Must be an array.
31+
`separator` | Required | A string separator to use when joining field values. If not specified, then the values are concatenated without a separator.
32+
`target_field` | Optional | The field to assign the cleaned value to. If not specified, then the field is updated in place.
33+
`description` | Optional | A description of the processor's purpose or configuration.
34+
`if` | Optional | Specifies to conditionally execute the processor.
35+
`ignore_failure` | Optional | Specifies to ignore failures for the processor. See [Handling pipeline failures]({{site.url}}{{site.baseurl}}/ingest-pipelines/pipeline-failures/).
36+
`on_failure` | Optional | Specifies to handle failures for the processor. See [Handling pipeline failures]({{site.url}}{{site.baseurl}}/ingest-pipelines/pipeline-failures/).
37+
`tag` | Optional | An identifier for the processor. Useful for debugging and metrics.
38+
39+
## Using the processor
40+
41+
Follow these steps to use the processor in a pipeline.
42+
43+
### Step 1: Create a pipeline
44+
45+
The following query creates a pipeline named `example-join-pipeline` that uses the `join` processor to concatenate all the values of the `uri` field, separating them with the specified separator `/`:
46+
47+
```json
48+
PUT _ingest/pipeline/example-join-pipeline
49+
{
50+
"description": "Example pipeline using the join processor",
51+
"processors": [
52+
{
53+
"join": {
54+
"field": "uri",
55+
"separator": "/"
56+
}
57+
}
58+
]
59+
}
60+
```
61+
{% include copy-curl.html %}
62+
63+
### Step 2 (Optional): Test the pipeline
64+
65+
It is recommended that you test your pipeline before you ingest documents.
66+
{: .tip}
67+
68+
To test the pipeline, run the following query:
69+
70+
```json
71+
POST _ingest/pipeline/example-join-pipeline/_simulate
72+
{
73+
"docs": [
74+
{
75+
"_source": {
76+
"uri": [
77+
"app",
78+
"home",
79+
"overview"
80+
]
81+
}
82+
}
83+
]
84+
}
85+
```
86+
{% include copy-curl.html %}
87+
88+
#### Response
89+
90+
The following example response confirms that the pipeline is working as expected:
91+
92+
```json
93+
{
94+
"docs": [
95+
{
96+
"doc": {
97+
"_index": "_index",
98+
"_id": "_id",
99+
"_source": {
100+
"uri": "app/home/overview"
101+
},
102+
"_ingest": {
103+
"timestamp": "2024-05-24T02:16:01.00659117Z"
104+
}
105+
}
106+
}
107+
]
108+
}
109+
```
110+
{% include copy-curl.html %}
111+
112+
### Step 3: Ingest a document
113+
114+
The following query ingests a document into an index named `testindex1`:
115+
116+
```json
117+
POST testindex1/_doc/1?pipeline=example-join-pipeline
118+
{
119+
"uri": [
120+
"app",
121+
"home",
122+
"overview"
123+
]
124+
}
125+
```
126+
{% include copy-curl.html %}
127+
128+
### Step 4 (Optional): Retrieve the document
129+
130+
To retrieve the document, run the following query:
131+
132+
```json
133+
GET testindex1/_doc/1
134+
```
135+
{% include copy-curl.html %}

0 commit comments

Comments
 (0)