Elasticsearch 5.2 with ServiceLib

VerifiedSafe

Usage of Elasticsearch 5.2 via ServiceLib.Elasticsearch wrapper for searching, indexing, bulk-loading, and alias-based index rebuilding.

Sby Skills Guide Bot
Data & AIAdvanced
7/28/2026
Claude CodeCursorWindsurfCopilotCodex
#elasticsearch#bulk-indexing#alias-management#rest-api#legacy-systems

Recommended for

Automated summary

Guides work against RI's frozen Elasticsearch 5.2 cluster through the ServiceLib.Elasticsearch HttpClient wrapper, covering search, indexing, bulk loading and alias-based index rebuilds.

Strengths

  • Captures the real ES 5.2 quirks (_type in bulk metadata, int hits.total, no NEST)
  • Provides a zero-downtime rebuild recipe using timestamped indices and an atomic alias swap
  • Documents the DeAliasURL workaround because ES 5.2 misroutes single-document operations sent to an alias
  • Spells out BulkToJson's null asymmetry to keep output compatible with the legacy Java pipeline

Limitations

  • Tightly coupled to RI internals (ServiceLib.Elasticsearch, JordanPrice) and not portable as-is
  • Assumes access to Elasticsearch.cs and reference-wrapper.md, which are not part of the SKILL
  • Does not address explicit mappings since indices rely on auto-detection
When to use it

Use it whenever a task touches RI's ES 5.2 cluster: queries, indexing, bulk loads, scroll downloads or full index rebuilds.

When not to use it

Avoid it for a modern Elasticsearch cluster (7.x/8.x) or outside the ServiceLib.Elasticsearch wrapper, whose API shapes and conventions differ.

Security analysis

Safe
Quality score88/100

The skill is a pure documentation/instruction file describing how to use an internal Elasticsearch 5.2 cluster via an HttpClient wrapper. It contains no executable commands, no network fetches, no credential handling, and no destructive shell operations; the described index/alias rebuild and scroll cleanup are standard, reversible data-management practices.

No concerns found

How this analysis is made

Examples

Rebuild index with alias swap
Rebuild the price_discount index on our ES 5.2 cluster: create a timestamped index, bulk-load all documents, then atomically switch the alias, and clean up the new index if anything fails.
Fix alias document operation
Our single-document DELETE against the price_discount alias isn't hitting the right shard on ES 5.2 — rewrite it to resolve the alias to its concrete index using DeAliasURL.
Bulk load a batch
Write the bulk request to load these documents into ES 5.2 using BulkToJson, and make sure the action metadata lines keep nulls while document lines drop them.

name: Elasticsearch description: Use when searching, indexing, bulk-loading, or rebuilding indices on RI's Elasticsearch cluster (locked at 5.2) via ServiceLib.Elasticsearch.

Elasticsearch (5.2, fixed)

The cluster runs Elasticsearch 5.2 and will not change. Use ES 5.2 API shapes: _type still exists in bulk metadata, hits.total is a plain int, and modern client libraries won't work. We do not use NEST — ServiceLib.Elasticsearch is a plain HttpClient wrapper over the REST API.

Working code in this folder: Elasticsearch.cs (the ServiceLib wrapper) and ElasticsearchService.cs (JordanPrice's use of it, including the full alias rebuild). Method-level detail: reference-wrapper.md.

Conventions

  • Search results are parsed as dynamic (Newtonsoft) and navigated by property name: result.hits.hits[0]._source, null-safe with ?. and ?.ToString() ?? "". No typed models.
  • Complex queries are raw string literals ($$"""...""") with interpolated values.
  • Wrapper methods return the string "Error" on failure rather than throwing — callers must check for it.
  • Indices are created without explicit mappings — let ES auto-detect field types (matches production).
  • Scroll downloads (DownloadIndex): 5000-doc batches, 1m timeout, and the scroll context is always cleared in a finally block — leaked scroll contexts hold resources on this old cluster.

Index rebuild: timestamped index + alias (JordanPrice-proven)

Zero-downtime full rebuild, proven in JordanPrice:

  1. Create timestamped index, e.g. price_discount_20250116_123456
  2. Bulk-load all documents into it
  3. Atomically switch alias price_discount in one _aliases call (remove price_discount_* + add new index)
  4. On failure, delete the new index; rollback is just switching the alias back

Architectural direction: the legacy Java codebase writes whole timestamped indices and flips aliases as above. RI's stated direction for new work is in-place overwrites and deletes instead of full rebuilds — prefer that for new services, but the alias pattern remains the proven fallback for full reloads.

De-aliasing for document operations

ES 5.2 misroutes single-document operations addressed to an alias. The wrapper's DeAliasURL/ConcreteIndex resolve an alias to its concrete index first and build URLs as /{concrete_index}/{alias}/{id}. Any direct document PUT/DELETE against a name that might be an alias must go through this (see reference-wrapper.md).

Bulk format nulls (BulkToJson)

BulkToJson builds the NDJSON body with an asymmetry that matters: action metadata lines are serialized keeping nulls, document lines ignoring nulls. Keep that split when touching bulk code — dropping nulls from metadata or including them in documents both cause subtle diffs against the legacy Java output.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/elasticsearch-5-2-with-servicelib-ms47vo8q/download' --output '.skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q/SKILL.md.part' && mv '.skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q/SKILL.md.part' '.skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/elasticsearch-5-2-with-servicelib-ms47vo8q/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills