<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Valentin Crettaz - Elasticsearch Labs]]></title>
    <description><![CDATA[Articles and tutorials from the Search team at Elastic]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Valentin Crettaz - Elasticsearch Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1121c0bf0e8a6e65/6a88da6340a1841030ef456f/search-labs-thumbnail.png</url>
      <link>https://www.elastic.co/search-labs/author/valentin-crettaz</link>
    </image>
    <link>https://www.elastic.co/search-labs/author/valentin-crettaz</link>
    <atom:link href="https://www.elastic.co/search-labs/rss/author/valentin-crettaz.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[en]]></language>
    <lastBuildDate>Mon, 14 Sep 2026 18:33:53 GMT</lastBuildDate>
  <item>
    <title><![CDATA[The mystery stress your heap chart can't see: AutoOps now watches vector off-heap memory]]></title>
    <description><![CDATA[Dense vectors use off-heap memory your heap chart never shows. AutoOps detects memory pressure before vector RAM stress causes OOM.]]></description>
    <content:encoded><![CDATA[<p>AutoOps now raises a <strong>Vector memory pressure</strong> insight when dense vector off-heap footprint, heap heat, and operational stress converge on the same Elasticsearch node. We validated on a 4 GiB node under sustained k-nearest neighbor (kNN) ingest: The insight fired at ~75% heap with thread-pool stress, roughly an hour before saturation. Heap charts alone still looked moderate at that point. Dense vectors for kNN live outside the Java heap, so heap monitoring and circuit breakers never show the full vector RAM picture. Below, we walk through what the insight measures and why heap on its own misses this. We also discuss what to do when it fires.</p><h2>Why dense vectors create off-heap memory pressure that heap charts miss</h2><p>Semantic search and kNN rely on <a href="https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dense-vector"><code>dense_vector</code> fields</a>. Elasticsearch stores much of that data in off-heap memory. It’s related to how the Java Virtual Machine (JVM) operates, but it isn’t the same thing as heap usage.</p><p>In production, the heap versus off-heap split shows up in a familiar pattern:</p><ul><li><p>Heap looks fine for weeks, while the dense vector off-heap footprint quietly grows.</p></li><li><p>Heap circuit breakers stay quiet or only spike late because the pressure sits outside the JVM.</p></li><li><p>kNN search and bulk ingest slow down, queues build, and nothing on the dashboard points at vector RAM as the cause.</p></li></ul><p>Heap limits protect Java allocations. They don’t tell you whether vector off-heap footprint still fits the RAM envelope that your deployment actually runs in. AutoOps already watches cluster health broadly; Vector memory pressure adds a focused read for vector-heavy nodes when memory and load signals line up.</p><h2>How AutoOps measures vector RAM, heap, and headroom</h2><p>AutoOps works from the same node stats metrics you already use for Stack Monitoring. For each node, it tracks three derived numbers:</p><p><strong>Symbol</strong></p><p><strong>Meaning</strong></p><p><strong>Source (typical)</strong></p><p><strong>Chart (see below)</strong></p><p><strong>V</strong></p><p>Vector off-heap footprint</p><p><code>indices.dense_vector.off_heap.total_size_bytes</code></p><p>First, green line</p><p><strong>A</strong></p><p>Available RAM in the product view</p><p>Delta between <code>os.mem.total_in_bytes</code> and <code>os.mem.used_in_bytes</code></p><p>Second, green line</p><p><strong>H</strong></p><p>Headroom</p><p><strong>A − V</strong> (headroom_bytes)</p><p>First, blue line</p><p>H &gt; 0 means there’s a modeled runway: Vector use still fits comfortably in that accounting. H ≤ 0 means that you’re in a <em>compression</em> regime: Vector footprint (V) meets or exceeds the free RAM (A) picture that AutoOps can align in telemetry. On small tiers, that can be common under load. The insight emphasizes trends, growth in vector off-heap footprint, and corroborating stress, not a single negative snapshot.</p><p>AutoOps also tracks a compression regime flag (fraction of recent samples where H ≤ 0), so brief flickers don’t dominate the story (see third chart below):</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt437840e9160da903/6a73173af9a79dca2a61f13e/image4.png" alt="AutoOps charts showing vector off-heap footprint growth, shrinking RAM headroom, and compression regime over 48 hours" /><h2>How vector memory pressure detection works: Expansion and compression</h2><p>Vector memory pressure is a single HIGH severity AutoOps event, which adapts to the compression regime:</p><ul><li><p><strong>Expansion (</strong><strong>H &gt; 0</strong><strong>):</strong> Emphasize shrinking headroom, hence a growing vector off-heap footprint.</p></li><li><p><strong>Compression (</strong><strong>H ≤ 0</strong><strong>):</strong> Emphasize ΔV, heap context, I/O, and latency. "Hours until H hits zero" isn’t the main narrative when headroom is already gone.</p></li></ul><p>The detector requires three layers before it fires:</p><ol><li><p><strong>Memory carriers:</strong> Compression regime, shrinking headroom, or sustained growth in vector off-heap footprint.</p></li><li><p><strong>Operational latch:</strong> Search or indexing latency versus rolling baselines, filesystem read stress (paired with latency or heap), indexing throttle, thread-pool queues or rejections, segment creep, or heap circuit breakers when paired with other stress, as circuit breakers alone don’t provide enough evidence to be escalated without corroborating stress.</p></li><li><p><strong>Heap hot:</strong> Heap usage elevated versus a 24-hour rolling median on that node, so compression alone on a calm heap doesn’t fire the insight.</p></li></ol><p>That pairing is intentional. Vector pressure without load might be capacity planning, and load without vector pressure might be a different root cause. Together, vector memory, operational stress, and heap heat surface the vector RAM story when the node is actually in trouble, not on every compressed mapping while the heap stays normal.</p><h2>Validation: Memory pressure detection on a 4 GiB node under kNN load</h2><p>We stress-tested vector memory pressure detection on 4 GiB Elastic Cloud Hosted deployments with throttled dense-vector ingest (~2,000 docs per minute) and steady kNN search (~8 queries per second). Across <a href="https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dense-vector">Hierarchical Navigable Small World (HNSW)</a>, <a href="https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/bbq#bbq-hnsw">Better Binary Quantization (BBQ) HNSW</a>, and <a href="https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/bbq#bbq-disk">DiskBBQ</a> mapping profiles over 24–48 hours:</p><ul><li><p>Vector off-heap footprint grew from near zero to about 6 GiB on the tightest runs (more than 4.7 million vectors indexed) in both HNSW test runs.</p></li><li><p>Nodes spent most of each run in compression (H ≤ 0), which is expected when vector footprint exceeds total RAM in this model.</p></li><li><p>Vector memory pressure stayed off while heap held near 50%, even with compression and pool stress building.</p></li><li><p>On both HNSW and BBQ HNSW, the insight fired once heap climbed past ~75% with memory compression and thread-pool queue stress, roughly an hour before heap neared saturation. Node out of memory (OOM) and circuit breakers followed in the same window, as did slow search/indexing. As we can see on the dashboard below, performance drops drastically due to corroborating stress toward the end of the test run:</p></li></ul><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt8a99d9296a444dbb/6a73176d0da67336ea57999d/image2.png" alt="HNSW validation dashboard showing heap climbing past 75% with search and indexing performance degradation" /><ul><li>On DiskBBQ, where compression was chronic but heap stayed normal, the insight didn’t fire,since storage rather than memory was the limiting factor. Disk and watermark signals are the right path to follow for that profile. As we can see on the screenshot below, all indicators stayed steady with constant performance throughout the test, even though we filled up the disk with more than 70 million vectors on the same instance type:</li></ul><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3f30c606a7005a82/6a731789ef5befd2394f7896/image5.png" alt=" DiskBBQ validation dashboard showing stable heap, steady search and indexing performance over 10 days" /><p>That timing is the point: Operators get a vector-first read tied to real RAM stress, with subsystem context, rather than an alert on every compressed index or only a red heap chart after the node is fighting on every front.</p><h2>What to do when AutoOps raises vector memory pressure</h2><p>Here’s the insight that AutoOps now raises when it detects vector memory pressure:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6a5bcf4dd55dc5fb/6a7317abe35d0255150319be/image3.png" alt="AutoOps Vector memory pressure insight with detection summary and recommendations for an Elasticsearch node" /><p>Recommendations in the product map to concrete actions:</p><ol><li><p><strong>Reduce vector footprint</strong> where quality allows: Fewer dimensions, quantized mappings, archive or split indices, reindex with a leaner mapping.</p></li><li><p><strong>Tune kNN load:</strong> Lower <code>num_candidates</code>, reduce concurrent query rate, narrow filtered kNN where possible.</p></li><li><p><strong>Consider DiskBBQ</strong> when HNSW in RAM is the bottleneck (evaluate recall/latency trade-offs for your use case). If you’re already on DiskBBQ and the heap memory is calm, treat disk and watermark insights as the primary signals. Note that DiskBBQ requires an Enterprise license.</p></li><li><p><strong>Right-size RAM</strong> when vector off-heap footprint (V) trends up and headroom stays tight.</p></li></ol><p>AutoOps links affected nodes and summarizes regime and stress in plain language. Treat it as “act now, rather than waiting for red on every chart.”</p><h2>Where AutoOps vector memory pressure monitoring is available</h2><p>Vector memory pressure is available wherever AutoOps runs against Elasticsearch 9.2+, including:</p><ul><li><p>Elastic Cloud Hosted (ECH).</p></li><li><p>Elastic Cloud Serverless (coming soon).</p></li><li><p>Self-managed via <a href="https://www.elastic.co/docs/deploy-manage/monitor/autoops/cc-autoops-as-cloud-connected">Cloud Connect</a>.</p></li></ul><p>AutoOps is included at all subscription levels for supported deployment types and doesn’t consume ECUs on ECH.</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/vector-memory-pressure-autoops</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/vector-memory-pressure-autoops</guid>
    <category><![CDATA[AutoOps]]></category>
    <category><![CDATA[Vector Database]]></category>
    <category><![CDATA[Operations]]></category>
    <dc:creator><![CDATA[Valentin Crettaz]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1ec5b14f053bdc56/6a73170a89eb5c6c9bab24c6/image1.png" length="0" type="image/png"/>
    <pubDate>Thu, 06 Aug 2026 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Elasticsearch query logs: One coordinator-level line per query for ES|QL, DSL, SQL, and EQL]]></title>
    <description><![CDATA[Easily understand query impact on cluster performance with Elasticsearch query logs. One coordinator-level line records ES|QL, DSL, SQL, and EQL per request and provides full query text, tracing, optional user context, and CCS hints]]></description>
    <content:encoded><![CDATA[<p>Your dashboard times out and CPU spikes, but which query actually ran? Slow logs give you one line per shard; Elasticsearch query logs give you one JSON line per request, with the same end-to-end duration as the took you already trust from the API. That single line also captures full query text for ES|QL, DSL, SQL, and EQL, outcomes, tracing, optional user context, and cross-cluster hints when relevant.</p><p>They’re ECS-aligned, ready for Discover and out-of-the-box dashboards once you ship the log, no custom schema project. Below: why we built this, how it differs from slow logs, what each line contains, and how to turn it on.</p><h2>Why we built this (you asked, a lot!)</h2><p>Coordinator-level query logging has been a very popular request; we listened and delivered! The same pain kept showing up: You want the <em>response</em> duration for Service Level Objectives (SLOs) and dashboards. You want to know the execution time of queries executed in your cluster, and you want to be able to see the full query.</p><p>If using cross-cluster search, a search that fans out across clusters looks like one operation from the app or Kibana, but operationally it’s a chain of work: coordination, remote execution, merges, timeouts, and partial results. When something is slow or flaky, teams need to know not only how long the request took but also which clusters contributed and whether the outcome was success, partial, or a hard failure.</p><p><strong>What you get:</strong> One log stream, one entry per query! Every entry has the coordinator duration (the very same <code>took</code> time that actually matches your search API response), success or failure, and the full query text. Elastic Common Schema–compliant (ECS) JSON, optional duration threshold and user/audit fields, plus <code>X-Opaque-Id</code> that lets you <a href="https://www.elastic.co/docs/troubleshoot/kibana/trace-elasticsearch-query-to-the-origin-in-kibana">trace a hot query</a> back to the saved object it originates from, and the trace ID so you can correlate with Kibana or your own tooling.</p><p><strong>What’s more:</strong> Logs follow a stable, ECS-aligned schema, which means you don’t need to design your own ingestion pipelines or field mappings. This consistency enables out-of-the-box dashboards and analytics that work immediately once logs are shipped.</p><h2>Slow logs vs. query logs: The 30-second version</h2><p>Slow logs have been the go-to tool for years. They tell you which search operation is slow, but they emit <strong>one line per shard</strong> that took part, where each line reflects that shard’s piece of the work. This means that they don’t provide a single row that says how long the query execution took, from the client’s perspective. Query logs do exactly that: <strong>one line per query</strong>, with the <strong>end-to-end (wall clock)</strong> duration that lines up with the <code>took</code> time in the search API response. This makes them much better suited for understanding workload patterns and identifying problematic queries quickly.</p><p>Slow and query logs also differ in when they fire and what they cover. Slow logs only write when a shard’s slice breaches a duration threshold; that is, you’re optimized for “show me unusually slow shard work.” Query logs can record every query (or only those above a configurable threshold you set at the cluster level), so you can tune volume for analytics versus troubleshooting. Slow logs only support DSL queries, while query logs cover <strong>ES|QL, DSL, SQL, and EQL</strong>, which matches how you reason about “what ran on my cluster” in a modern stack. Both provide the same support in terms of correlation with headers, traces, and audit information (when you turn on user context).</p><p>The table below summarizes the main differences between the historical slow logs and the new query logs features.</p><p></p><p>Slow logs</p><p>Query logs</p><p>What they’re for</p><p>Finding hot shards / slow index operations on specific indices and classic performance tuning inside one cluster.</p><p>Understanding what query ran, how long the operation took end to end from the coordinator, and whether it succeeded, which is better for SLOs, analytics, and incident investigations.</p><p>Granularity</p><p>Per shard (and per phase) for searching slow logs: One user search can produce many lines across shards/replicas.</p><p>Per coordinator-level query: One query maps to one log event.</p><p>Scope of work</p><p>Query + indexing</p><p>Query only; indexing will come soon.</p><p>What you learn</p><p>“This shard on this index exceeded N ms in query/fetch phase.”</p><p>“This query (full text), this duration, this outcome, and (when relevant) federation/cross-cluster summary fields.”</p><p>Query types</p><p>DSL only</p><p>ES|QL, DSL, SQL, and EQL</p><p>Threshold model</p><p>Often tiered (for example, multiple time thresholds per log levels) and per index.</p><p>Single duration gate at the cluster level (for example, “log if duration ≥ 500ms”)</p><h2>What you get in each log line</h2><p>Every line is one JSON object (one request) in a dedicated file (for example, <code>*_querylog.json</code> under your Elasticsearch log directory). Below is what you can <em>do</em> with the data:</p><p><strong>Did it succeed, how long did it take, and what broke?</strong> Outcome (whether the request was successful or not), duration (<code>took / took_millis</code>, in line with the API), and a clear failure or timeout when something goes wrong. That’s the core signal for alerting, SLOs, and dashboards: “Are we green? If not, what’s the error?” You also get how many rows or hits came back (<code>result_count</code>), so you can separate “slow but empty” from “slow and huge.”</p><p><strong>What actually ran?</strong> Query type (<code>esql</code>, <code>dsl</code>, <code>sql</code>, <code>eql</code>) plus the <strong>full query text</strong>. That answers “Which dashboard rule, saved search, or client pattern is hammering us?” Mix it with duration and outcome to find the worst offenders to fix or throttle.</p><p><strong>Who asked for it</strong>, and how do I trace it end to end? <strong>X-Opaque-Id</strong> and <strong>trace ID</strong> tie a line back to Kibana or your own headers. Task and optional parent task IDs help follow work that was enqueued or chained (async or nested operations).</p><p><strong>Cross-cluster search: </strong>Who participated, and did anyone misbehave? When cross-cluster search (CCS) is in play, the log can carry <strong>remote cluster aliases</strong>, per-cluster duration, and status (successful, failed, partial, skipped). You can see at a glance whether a slow search was local or a specific remote dragging the response. DSL can also record that a search was served from a remote alias; ES|QL exposes the richer cluster map; EQL logs a lighter view (for example, which remotes and how many) when remotes are involved.</p><p><strong>Security (optional).</strong> With <code>elasticsearch.querylog.include.user</code>, you get the usual identity and realm fields (plus effective user when run-as applies), and API key metadata when applicable. Pair with query text and duration for governance and capacity conversations that use names, not only IPs.</p><p>There’s more available than we covered here, including additional execution details, shard-level outcomes, and optional profiling information depending on the query type. For every field path and setting, see the <a href="https://www.elastic.co/docs/deploy-manage/monitor/logging-configuration/query-logs">Elasticsearch documentation on query logs</a>.</p><h2>Where the logs live (and how to use them)</h2><p>Logs land in your Elasticsearch log directory as <code>*_querylog.json</code> (for example, <code>mycluster_querylog.json</code>) on the coordinating node. Ship them with the <code>querylog</code> fileset in the <a href="https://www.elastic.co/docs/reference/beats/filebeat/filebeat-module-elasticsearch#_querylog_log_fileset_settings">Filebeat Elasticsearch module</a>, so you can then inspect them in Discover (filter by <code>event.dataset: elasticsearch.querylog</code>). On Elastic Cloud, you need to enable Logs on your deployment, and the query logs are shipped as soon as you enable them.</p><p><strong>Two workflows.</strong> If you need a one-off look to find out who’s hammering the cluster, what the query mix is, or a quick audit, just turn logging on, set a duration threshold so you only log what matters (for example, ≥ 1 s or ≥ 5 min), and then turn it off when you’re done. If you want <strong>ongoing query analytics</strong>, simply enable logging, point Filebeat at the log, and open a dashboard on the monitoring cluster. Two very simple steps, enable + ship, and you’re done. One request per line, one duration per request, no custom pipeline.</p><p>The dashboard below builds upon the new query logs and is provided out of the box. On the top row, you can find the P95/P99 query latencies (with an optional “acceptable latency” bar), the query type breakdown, the success and failure ratio, the user and system queries ratio, and (for DSL) hits versus aggregations. Underneath that, the latency over time (avg, p50, p95, p99, max) with a reference line so you can spot regressions, query volume over time (stacked by type), and tables for top indices, top users, and top error types. Filtering for cluster, user, or index lets you zoom into exactly what you want to focus on.</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltcc2ae00bd7a37f99/6a170ae4c1e8a57104f882c4/f913f860b7a7235fea9d4eeff935bd2e2aa61c0f-1999x1406.png" alt="Dashboard showing Elasticsearch query performance metrics, including P95 and P99 latency values, pie charts for query type distribution, success versus failure, user versus system queries, and hits versus aggregations, line and bar charts for query latency and volume over time, and tables listing top indices, top users, and top error types." /><p><strong>Heads up.</strong> Logging of queries is asynchronous, so it doesn’t block the query execution. Use the duration threshold to cap volume. Also worth noting that at very high queries per second (QPS), we may drop some lines rather than slow your cluster down. For analytics, shipping to a separate monitoring cluster keeps the cluster you’re debugging from taking the extra load.</p><h2>Some configuration and code samples</h2><p>Query logging is <strong>off by default</strong>. Flip it on in <code>elasticsearch.yml</code> or via the cluster settings API. Here’s how.</p><h3>Enable query logging</h3><p>In <code>elasticsearch.yml</code>:</p>elasticsearch.querylog.enabled: true<p>Or dynamically via the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html">cluster settings API</a>:</p>PUT _cluster/settings
{
  "persistent": {
    "elasticsearch.querylog.enabled": "true"
  }
}<h3>Only log queries above a duration threshold</h3><p>If you don’t want to log every health check or tiny request, simply set a threshold so only queries that run at least this long get an entry. Duration is in <strong>time units</strong>:</p>PUT _cluster/settings
{
  "persistent": {
    "elasticsearch.querylog.enabled": "true",
    "elasticsearch.querylog.threshold": "1s"
  }
}<h3>Include user/audit information</h3><p>If you use the Security plugin and want to see <em>who</em> ran each query:</p>PUT _cluster/settings
{
  "persistent": {
    "elasticsearch.querylog.enabled": "true",
    "elasticsearch.querylog.include.user": "true"
  }
}<h3>Log DSL searches that hit only system indices</h3><p>By default, searches that target <em>only</em> system indices aren’t logged. To include them, enable query logging and set:</p>PUT _cluster/settings
{
  "persistent": {
    "elasticsearch.querylog.enabled": "true",
    "elasticsearch.querylog.include.system_indices": "true"
  }
}<h3>Example log entries</h3><p>One line = one JSON object = one request with the same shape for ES|QL, DSL, SQL, EQL. Below: a successful DSL search and afailed EQL query with timestamp, duration, query type, and full query. On success, you get result count and shard stats, on failure an <code>error</code> block. User-inclusion and X-Opaque-Id show up when you’ve enabled them.</p><p><strong>Success (DSL search):</strong></p>{
  "@timestamp": "2026-03-04T19:40:34.736Z",
  "log": {
    "level": "INFO",
    "logger": "elasticsearch.querylog"
  },
  "event": {
    "duration": 1000000,
    "outcome": "success"
  },
  "elasticsearch": {
    "querylog": {
      "type": "dsl",
      "query": "{\"size\":10,\"query\":{\"match_all\":{\"boost\":1.0}}}",
      "indices": ["query_log_test_index"],
      "result_count": 3,
      "search": { "total_count": 3 },
      "shards": { "successful": 1 },
      "took": 1000000,
      "took_millis": 1
    },
    "node": { "name": "node-1" },
    "cluster": { "name": "my-es-cluster" }
  },
  "http": {
    "request": {
      "headers": { "x_opaque_id": "opaque-1772653234" }
    }
  },
  "user": {
    "name": "elastic",
    "realm": "reserved"
  }
}<p><strong>Failure (EQL query):</strong></p>{
  "@timestamp": "2026-03-04T19:40:35.271Z",
  "log": {
    "level": "INFO",
    "logger": "elasticsearch.querylog"
  },
  "event": {
    "duration": 1326334,
    "outcome": "failure"
  },
  "elasticsearch": {
    "querylog": {
      "type": "eql",
      "query": "any where true",
      "indices": ["nonexistent_index_xyz"],
      "result_count": 0,
      "took_millis": 1
    },
    "node": { "name": "node-1" },
    "cluster": { "name": "my-es-cluster" }
  },
  "error": {
    "type": "org.elasticsearch.index.IndexNotFoundException",
    "message": "no such index [Unknown index [nonexistent_index_xyz]]"
  }
}<h2>Wrapping up</h2><p><strong>Elasticsearch query logs</strong> provide you with one single coordinator-level log for every query (ES|QL, DSL, SQL, EQL). One line per request, coordinator duration, full query, optional user and <code>X-Opaque-Id</code>. Enable it, set a duration threshold and user-inclusion if you want them, and you’re done. Logs live in your log dir (<code>*_querylog.json</code>), and when shipped with Filebeat, you can find them in Discover under the <code>elasticsearch.querylog</code> dataset.</p><p>Head to the <a href="https://www.elastic.co/docs/deploy-manage/monitor/logging-configuration/query-logs">Elasticsearch documentation on query logs</a> for the full list of configuration settings, and field references. Slow or broken queries can also be found in <a href="https://www.elastic.co/search-labs/blog/slow-search-elasticsearch-query-autoops">AutoOps</a>, which leverages the <code>X-Opaque-Id</code> to tie a long-running search back to its origin, such as a dashboard, a saved search, or an alerting rule.</p><p>Finally, it’s also worth noting that this new query log is an evolution of the <a href="https://www.elastic.co/docs/reference/query-languages/esql/esql-query-log">ES|QL-only query log</a> that we released in 9.2. We recommend adopting the new query log since it not only supports ES|QL queries, but also all your other queries.</p><p>Now, go see what’s actually running in your cluster.</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/elasticsearch-query-logs</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/elasticsearch-query-logs</guid>
    <category><![CDATA[Inside Elastic]]></category>
    <category><![CDATA[Basics]]></category>
    <category><![CDATA[Query Languages]]></category>
    <dc:creator><![CDATA[Najwa Harif,Valentin Crettaz]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4cb4463cec71b906/6a170ae6ab7f0834cfdb9e73/31f1d882d6c0b62bd5ba320c89bda5700434c25c-1672x941.png" length="0" type="image/png"/>
    <pubDate>Tue, 12 May 2026 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Parsing JSON fields in Elasticsearch]]></title>
    <description><![CDATA[Learn how to parse JSON fields in Elasticsearch using an ingest pipeline to efficiently index, query, and aggregate JSON data.]]></description>
    <content:encoded><![CDATA[<p>In this article, we will discuss how to parse JSON fields in Elasticsearch, which is a common requirement when dealing with log data or other structured data formats. We will cover the following topics:</p><ol><li><p>Ingesting JSON data into Elasticsearch</p></li><li><p>Using an Ingest Pipeline to parse JSON fields</p></li><li><p>Querying and aggregating JSON fields</p></li></ol><h2>1. Ingesting JSON data into Elasticsearch</h2><p>When ingesting JSON data into Elasticsearch, it is essential to ensure that the data is properly formatted and structured. Elasticsearch can automatically detect and map JSON fields, but it is recommended to define an explicit mapping for better control over the indexing process.</p><p>To create an index with a custom mapping, you can use the following API call:</p>PUT /my_index
{
 "mappings": {
   "properties": {
     "message": {
       "type": "keyword"
     },
     "json_field": {
       "properties": {
         "field1": {
           "type": "keyword"
         },
         "field2": {
           "type": "integer"
         }
       }
     }
   }
 }
}<p>In this example, we create an index called <code>my_index</code> with a custom mapping for a JSON field named <code>json_field</code>.</p><h2>2. Using an Ingest Pipeline to parse JSON fields</h2><p>If your JSON data is stored as a string within a field, you can use the Ingest Pipeline feature in Elasticsearch to parse the JSON string and extract the relevant fields. The Ingest Pipeline provides a set of built-in processors, including the <code>json</code> processor, which can be used to parse JSON data.</p><p>To create an ingest pipeline with the <code>json</code> processor, use the following API call:</p>PUT _ingest/pipeline/json_parser
{
 "description": "Parse JSON field",
 "processors": [
   {
     "json": {
       "field": "message",
       "target_field": "json_field"
     }
   }
 ]
}<p>In this example, we create an ingest pipeline called <code>json_parser</code> that parses the JSON string stored in the <code>message</code> field and stores the resulting JSON object in a new field called <code>json_field</code>.</p><p>To index a document using this pipeline, use the following API call:</p>POST /my_index/_doc?pipeline=json_parser
{
 "message": "{\"field1\": \"value1\", \"field2\": 42}"
}<p>The document will be indexed with the parsed JSON fields:</p>{
 "_index": "my_index",
 "_type": "_doc",
 "_id": "1",
 "_source": {
   "message": "{\"field1\": \"value1\", \"field2\": 42}",
   "json_field": {
     "field1": "value1",
     "field2": 42
   }
 }
}<h2>3. Querying and aggregating JSON fields</h2><p>Once the JSON fields are indexed, you can query and aggregate them using the Elasticsearch Query DSL. For example, to search for documents with a specific value in the <code>field1</code> subfield, you can use the following query:</p>POST /my_index/_search
{
 "query": {
       "term": {
         "json_field.field1": "value1"
       }
 }
}<p>To aggregate the values of the <code>field2</code> subfield, you can use the following aggregation:</p>POST /my_index/_search
{
 "size": 0,
 "aggs": {
   "field2_sum": {
         "sum": {
           "field": "json_field.field2"
         }
 }
}<h2>Bonus: How to deal with unparsed JSON data?</h2><p>If you are in the situation where you have already ingested unparsed JSON data into a text/keyword field, there’s a way to extract the JSON data without having to reindex everything from scratch.</p><p>You can leverage the <a href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update-by-query#operation-update-by-query-pipeline">Update by Query API</a> with the ingest pipeline developed in section 2. But before running that update, you’ll first need to update your index mapping similarly to what we did in section 1 to add the <code>json_field</code> mapping, by running the command below:</p>PUT /my_index/_mapping
{
  "properties": {
    "json_field": {
      "properties": {
        "field1": {
          "type": "keyword"
        },
        "field2": {
          "type": "integer"
        }
      }
    }
  }
}<p>When done, you can simply run the command below, which will iterate over all documents in your index, extract the JSON from the <code>message</code> field and index the parsed JSON data into the <code>json_field</code> object.</p>POST /my_index/_update_by_query?pipeline=json_parser<h2>Conclusion</h2><p>In conclusion, parsing JSON fields in Elasticsearch can be achieved using custom mappings, the Ingest Pipeline feature, and the Elasticsearch Query DSL. By following these steps, you can efficiently index, query, and aggregate JSON data in your Elasticsearch cluster.</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/elasticsearch-parse-json-field-ingest-pipeline</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/elasticsearch-parse-json-field-ingest-pipeline</guid>
    <category><![CDATA[Basics]]></category>
    <dc:creator><![CDATA[Valentin Crettaz]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6d8bd040a15da207/6a17e422414c640e67945116/ef9edded97edd7c919e617e648e62016155cde56-720x420.jpg" length="0" type="image/jpeg"/>
    <pubDate>Fri, 17 Oct 2025 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>