$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
SearchintermediateNew

Elasticsearch Setup

Share

Set up Elasticsearch with indexing and full-text search

Works with OpenClaude

You are a search infrastructure engineer. The user wants to set up Elasticsearch with indexing and full-text search capabilities.

What to check first

  • Run elasticsearch --version to confirm Elasticsearch is installed (v7.0+)
  • Verify Java is installed with java -version (required for Elasticsearch to run)
  • Check that port 9200 is available with lsof -i :9200 (default Elasticsearch HTTP port)

Steps

  1. Start Elasticsearch using ./bin/elasticsearch on Linux/macOS or .\bin\elasticsearch.bat on Windows
  2. Verify the cluster is running with curl http://localhost:9200 — you should see cluster info JSON
  3. Create an index with a PUT request specifying the analyzer and field mappings for full-text search
  4. Configure the text field type with analyzer: "standard" for tokenization and lowercasing
  5. Add documents to the index using the _doc endpoint with POST or PUT requests
  6. Execute a match query on text fields to perform full-text search across tokens
  7. Use _search endpoint with bool queries to combine multiple search conditions
  8. Monitor indexing performance with the _stats endpoint to check document count and shard status

Code

const { Client } = require('@elastic/elasticsearch');

const client = new Client({ node: 'http://localhost:9200' });

async function setupElasticsearch() {
  try {
    // Create index with full-text search mapping
    await client.indices.create({
      index: 'articles',
      body: {
        settings: {
          number_of_shards: 1,
          number_of_replicas: 0,
          analysis: {
            analyzer: {
              custom_analyzer: {
                type: 'standard',
                stopwords: '_english_'
              }
            }
          }
        },
        mappings: {
          properties: {
            title: {
              type: 'text',
              analyzer: 'custom_analyzer',
              fields: {
                keyword: { type: 'keyword' }
              }
            },
            content: {
              type: 'text',
              analyzer: 'custom_analyzer'
            },
            author: { type: 'keyword' },
            published_date: { type: 'date' }
          }
        }
      }
    });
    console.log('Index created successfully');

    // Index documents
    await client.index({
      index: 'articles',
      id: '1',
      body: {
        title: 'Introduction to Elasticsearch',
        content: 'Elasticsearch is a powerful search and analytics engine built on top of Lucene.',
        author: 'John Doe',
        published_date: '2024-01-15'
      }
    });

    await client.index({
      index: 'articles',
      id: '2',
      body

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategorySearch
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
searchelasticsearchfull-text

Install command:

curl -o ~/.claude/skills/elasticsearch-setup.md https://claude-skills-hub.vercel.app/skills/search/elasticsearch-setup.md

Related Search Skills

Other Claude Code skills in the same category — free to download.

Want a Search skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.