Files
honeymoose f321dfedf5 同步完成!
**同步结果摘要**:

| 目录 | 同步前 | 同步后 | 官方 |
|------|--------|--------|------|
| aggregations | 40 | 65 | 64 |
| analyzers | 8 | 141 | 140 |
| api-reference | 97 | 186 | 174 |
| benchmark | 34 | 67 | 53 |
| clients | 17 | 18 | 18 |
| dashboards | 38 | 149 | 131 |
| data-prepper | 77 | 134 | 123 |
| im-plugin | 22 | 37 | 37 |
| ingest-pipelines | 27 | 52 | 51 |
| install-and-configure | 37 | 57 | 53 |
| ml-commons-plugin | 81 | 157 | 155 |
| observing-your-data | 39 | 73 | 66 |
| query-dsl | 40 | 77 | 75 |
| search-plugins | 80 | 139 | 95 |
| security-analytics | 22 | 47 | 46 |

**说明**:
- 本地文件数 > 官方:本地有一些官方已删除或重命名的文件
- 新增了约 **740 个英文文档文件**
- 已有文件保持不变(未覆盖)
2026-11-30 10:48:30 -05:00

3.4 KiB

layout, title, parent, grand_parent, nav_order
layout title parent grand_parent nav_order
default join() Functions Pipelines 25

join() function

The join() function joins elements of a list to form a string. The function takes a JSON pointer, which represents the key to a list or map where values are of the list type, and joins the lists as strings using a delimiter. The default delimiter is a comma (,).

Parameters

The join function takes the following parameters:

  • delimiter (string, optional): The string placed between elements. Examples: ,, |, ; . Default is ,.
  • pointer (required): A JSON pointer resolving to a list in the event.

Returns

The join command returns the following value:

  • string: All elements concatenated using the specified delimiter.

Quick examples

  • join("-", /labels) returns "prod-api-us" for labels: ["prod","api","us"]
  • join(" | ", /authors) returns "Ada | Linus | Grace" for authors: ["Ada","Linus","Grace"]

Using join() in a pipeline

You can use join() inside processors that support value_expression, for example, the add_entries processor:

processor:
  - add_entries:
      entries:
        - key: labels_csv
          value_expression: join(" | ", /labels)

{% include copy.html %}

Example

The following pipeline ingests JSON events using an http source. It then uses add_entries with join() to build two new fields, labels_csv and authors_pipe:

join-demo:
  source:
    http:
      path: /events
      ssl: false
  processor:
    - add_entries:
        entries:
          - key: labels_csv
            value_expression: join(/labels) # Comma is used by default
          - key: authors_pipe
            value_expression: join(" | ", /authors)
  sink:
    - opensearch:
        hosts: ["https://opensearch:9200"]
        index: join-demo-%{yyyy.MM.dd}
        username: admin
        password: "<custom-admin-password>"
        index_type: custom
        insecure: true  # set to true for self-signed local clusters

{% include copy.html %}

You can test the pipeline using the following command:

curl "http://localhost:2021/events" \
   -H "Content-Type: application/json" \
   -d '[
    {"message":"hello","labels":["prod","api","us"],"authors":["Ada","Linus","Grace"]},
    {"message":"world","labels":["stage","etl"],"authors":["Marie","Alan"]}
  ]'

{% include copy.html %}

The document stored in OpenSearch contains the following information:

{
  ...
  "hits": {
    "total": {
      "value": 2,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "join-demo-2025.11.06",
        "_id": "aGFyWZoBjfY5UoR7NC36",
        "_score": 1,
        "_source": {
          "message": "hello",
          "labels": [
            "prod",
            "api",
            "us"
          ],
          "authors": [
            "Ada",
            "Linus",
            "Grace"
          ],
          "labels_csv": "prod,api,us",
          "authors_pipe": "Ada | Linus | Grace"
        }
      },
      {
        "_index": "join-demo-2025.11.06",
        "_id": "aWFyWZoBjfY5UoR7NC36",
        "_score": 1,
        "_source": {
          "message": "world",
          "labels": [
            "stage",
            "etl"
          ],
          "authors": [
            "Marie",
            "Alan"
          ],
          "labels_csv": "stage,etl",
          "authors_pipe": "Marie | Alan"
        }
      }
    ]
  }
}