RousselTMLEARNING

Article · Elasticsearch: from discovery to expertise

Ingestion and ingest pipelines

1. The Bulk API #

Indexing in bulk.

NDJSON format #

POST _bulk
{ "create": { "_index": "logs-nginx-default" } }
{ "@timestamp": "2026-10-20T10:00:00Z", "message": "203.0.113.5 - - [20/Oct/2026:10:00:00 +0000] \"GET /api/cart HTTP/1.1\" 200 512 \"-\" \"Mozilla/5.0\"" }
{ "create": { "_index": "logs-nginx-default" } }
{ "@timestamp": "2026-10-20T10:00:01Z", "message": "198.51.100.7 - - [20/Oct/2026:10:00:01 +0000] \"POST /api/order HTTP/1.1\" 500 87 \"-\" \"curl/8.5\"" }
Good practice: Aim for bulk requests of 5 to 15 MB and always check the response's errors field: a « successful » bulk may contain rejected documents.

2. Ingest pipelines #

Transforming at ingestion.

Nginx pipeline #

Processors of an Nginx ingest pipeline
PUT _ingest/pipeline/nginx-access
{
  "processors": [
    { "grok": { "field": "message", "patterns": [ "%{IPORHOST:source.ip} - %{DATA:user.name} \\[%{HTTPDATE:nginx.time}\\] \"%{WORD:http.request.method} %{DATA:url.path} HTTP/%{NUMBER:http.version}\" %{NUMBER:http.response.status_code:int} %{NUMBER:http.response.body.bytes:long} \"%{DATA:http.request.referrer}\" \"%{DATA:user_agent.original}\"" ] } },
    { "date":       { "field": "nginx.time", "formats": [ "dd/MMM/yyyy:HH:mm:ss Z" ] } },
    { "geoip":      { "field": "source.ip", "target_field": "source.geo", "ignore_missing": true } },
    { "user_agent": { "field": "user_agent.original", "ignore_missing": true } },
    { "remove":     { "field": [ "nginx.time" ] } }
  ],
  "on_failure": [
    { "set": { "field": "event.kind", "value": "pipeline_error" } },
    { "set": { "field": "error.message", "value": "{{ _ingest.on_failure_message }}" } }
  ]
}

POST _ingest/pipeline/nginx-access/_simulate
{ "docs": [ { "_source": { "message": "203.0.113.5 - - [20/Oct/2026:10:00:00 +0000] \"GET /api/cart HTTP/1.1\" 200 512 \"-\" \"Mozilla/5.0\"" } } ] }
Good to know: dissect is faster than grok when the format is fixed (known separators); keep grok for variable formats.

3. Enrich and reindex #

Completing and reprocessing.

Enrich #

PUT _enrich/policy/customers
{ "match": { "indices": "customers", "match_field": "customer.id", "enrich_fields": [ "customer.tier", "customer.country" ] } }
POST _enrich/policy/customers/_execute

# dans un pipeline
{ "enrich": { "policy_name": "customers", "field": "customer.id", "target_field": "customer_info" } }

# retraiter un index existant avec un pipeline
POST _reindex
{ "source": { "index": "old-logs" }, "dest": { "index": "logs-nginx-default", "op_type": "create", "pipeline": "nginx-access" } }

Logstash and Elastic Agent remain useful when you need varied sources, buffers or multiple outputs; ingest pipelines are enough to transform what already arrives in Elasticsearch.

📄 Elasticsearch ingestion: Bulk API, ingest pipelines, enrich and reindex →

My progress

  • ⏱ Estimated time : ≈ 6 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

3.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.

Authentication

The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).

Authorization

The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.

API Key

A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

Repository

A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...

Elasticsearch

A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.

Recommended Articles

Feeding OpenSearch: ingest pipelines and Data Prepper

Transform data with ingest pipelines, collect with Data Prepper, receive OTLP and avoid the dynam...

Transforms and enrich: summarising and enriching data in Elasticsearch

Build entity-centric indices with pivot and latest transforms, and enrich documents at ingest tim...

Agent policies, integrations, data streams and pipelines

Build agent policies, add integrations (System, Nginx, Custom Logs), choose namespaces, customise...

Index Lifecycle Management (ILM): data tiers, rollover and retention

Automate the index lifecycle with ILM: hot, warm, cold and frozen data tiers, rollover by size an...

Logstash: enrich, test, monitor and deploy on Kubernetes

Enrich with translate, geoip and elasticsearch, consume Kafka, test pipelines, monitor Logstash a...

Logstash: filters, grok and dissect

Written version of the video lessons: essential filters (mutate, date, json, kv, drop), the grok ...

Elasticsearch data streams and templates: component templates, index templates and time series

Manage timestamped data with data streams: index templates and component templates, the type-data...

Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD

Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...

Logstash best practices: pipelines, performance, reliability and monitoring

Logstash best practices: multiple pipelines, dissect rather than grok, conditionals, persistent q...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!