r/elasticsearch

Image 1 — Elastic101 – Best Practice #002: shard size
Image 2 — Elastic101 – Best Practice #002: shard size
Image 3 — Elastic101 – Best Practice #002: shard size

Elastic101 – Best Practice #002: shard size

I've spent close to a decade running Elasticsearch clusters in production, from 3-node dev setups to multi-hundred-node deployments handling billions of documents a day.

One thing I've seen repeatedly in production is that teams either let shards balloon for years without noticing, or over-correct and split everything into tiny shards "to be safe."

Elastic101 – Best Practice #002 – Shard Size

Smaller shards increase overhead more cluster state to track, more per-shard costs (file handles, memory, translog), and more coordination work on every query.

Larger shards cause the opposite problem: recovery and rebalancing get painfully slow, and a single hot shard can bottleneck an entire index.

>The goal is to keep shard size around 50GB.

Pro tip: you cannot simply change the primary shard count of an existing index. If you need to change it, you typically need to use the Reindex API or the Shrink API, depending on the situation. Also, if you reindex a 200GB index, you should have at least 200GB of additional free disk space available in the cluster for the new index. Choose your primary shard count wisely from the start, fixing it later is expensive.

Previous Elastic101 best practices:

  1. Elastic101 Best Practice #001 – HTTP traffic

Try here: Searchali Elasticsearch Monitoring Connect your cluster in 10 seconds. No agent. No data leaves your machine.

u/Feeling_Current534 — 2 days ago

Elastic101 Best Practice #001 - http traffic

I’ve been working with Elasticsearch for almost 10 years, including 6 years of consulting and 4 years of training teams on Elasticsearch and related technologies. Over the years, I’ve seen the same mistakes come up again and again in production clusters, so I thought I’d share some of the best practices I’ve learned along the way.

For the first best practice, a simple misconception that is surprisingly easy to get wrong:

>Don’t send application HTTP traffic directly to master nodes.

This may come from architectures like Kubernetes, where the control plane has a central API endpoint. Elasticsearch is different: master nodes are for cluster management, not application traffic.

>Use dedicated coordinating nodes or data nodes for client traffic.

As a general rule of thumb, for clusters with less than 20 nodes, adding more data nodes is often more efficient than adding dedicated coordinating-only nodes. Of course, this depends on your workload, especially the size and complexity of aggregations and heavy queries.

Master ≠ API Server.

Want to see this traffic flow in real time on your own cluster?

You can try the tool I built it takes less than 10 seconds to connect and see which clients are hitting which Elasticsearch nodes.

Try here: No agent or server-side installation required; the connection is made directly from your browser. Searchali Elasticsearch Monitoring

If you’d like me to continue this series, an upvote would be appreciated. 🙂

u/Feeling_Current534 — 8 days ago

Elastic Certified Engineer 8.15 — how hard is the real exam?

Hey everyone,

I'm planning to take the Elastic Certified Engineer exam (v8.15) very soon. I just did the practice exam and honestly found it pretty tough harder than I expected.

Is the real exam similarly difficult, or does the practice test tend to overestimate/underestimate the actual difficulty?

If anyone has taken it recently,

I'd really appreciate any tips, gotchas, or areas to focus on. Thanks in advance!

reddit.com
u/MysteriousGuy9 — 9 days ago

On-prem S3 recommendations

Hello everyone,

I am looking for recommendations for an on-premises, self-hosted S3-compatible object storage solution to act as a cold tier archive for our Elasticsearch cluster (preferably tested).

reddit.com
u/OutrageousLight6847 — 10 days ago

Elastic Agent/Fleet - Winlog input missing security events

Hey all

I'm working on deploying a Elastic stac POC but have hit a strange issue with collecting windows security event logs

Environment

  • Elasticsearch/Kibana/Fleet Server: 9.5.1
  • Tested Elastic Agent: 9.5.1 and 9.4.2
  • Windows Server 2019 domain controller
  • Agent installed as a Windows service running as NT AUTHORITY\SYSTEM
  • Fleet System integration has Application, Security and System enabled
  • Other Windows Event Logs are ingesting correctly (Application, System, PowerShell, Directory Service, DNS Server, Defender, etc.)

The problem is specifically i'm not seeing any "Security" event log data.

Running the following discover, I get no data

>host.name : "SERVERNAME" and data_stream.dataset : "system.security"

I can confirm there are security event

>Get-WinEvent -LogName Security -MaxEvents 10

Fleet senders the stream correct and elastic agent seems to be working

>Starting to read from Security
Reading from Security
windows event log opened successfully

I've tested this on a couple of machine's which have similar outcomes, missing security events. standalone WinLogBeat works on the same server with a simple config

>winlogbeat.event_logs:
- id: security-test
xml_query: >
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">*</Select>
</Query>
</QueryList>

But this doesn't work

>winlogbeat.event_logs:
- name: Security

Any suggestions where to go from here?

reddit.com
u/Whole_Photograph4698 — 8 days ago

Automatically deleting old data to avoid storage getting full.

I am in a situation where I have deployed elastic via ECK onto some kubernetes clusters and I am getting a large volume of logs that is somewhat un-predictable. I want to both delete data when it is past a certain age (easy) and also delete the oldest data when my PVC storage is 80% full (hard / not possible?).

Does anyone know how to do this? I can't come up with a good way to delete the oldest data that doesn't involve leaving elastic and writing some script to query how full my storage is and then query the oldest indices and delete them, but this feels hacky.

reddit.com
u/Alerintek — 12 days ago

Old indices reindex before upgrade

Hi all,
We're planning ES upgrade from 8.19 -> 9.4, and we have some 7.x indices, that needs to be reindexed before moving them. What options are there for reindex in a way not to block application read and writes? We have big indices, for example, I tested on one index 1000GB, it took 9 hours to reindex, and I don't know if there is a good way to apply all updates and deleted on that index that happened within that 9h interval after the reindex.

reddit.com
u/Rosie871 — 13 days ago