elasticsearch
БесплатноБез исполняемых скриптовНе проверенElasticsearch search and analytics engine. Full-text search, aggregations, document store. Use when implementing search functionality or log analytics. USE…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Elasticsearch - Quick Reference
Full Reference: See advanced.md for aggregations, autocomplete/suggestions, highlighting, custom analyzers, index templates, ILM, and Spring Data Elasticsearch.
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:elasticsearchfor comprehensive documentation.
Setup
# Docker
docker run -d --name elasticsearch \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
elasticsearch:8.12.0
# docker-compose.yml
services:
elasticsearch:
image: elasticsearch:8.12.0
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- "9200:9200"
volumes:
- esdata:/usr/share/elasticsearch/data
volumes:
esdata:
Node.js Client
npm install @elastic/elasticsearch
import { Client } from '@elastic/elasticsearch';
const client = new Client({
node: 'http://localhost:9200',
// With authentication
// auth: { username: 'elastic', password: 'password' }
});
// Health check
const health = await client.cluster.health();
console.log(health);
Index Management
Create Index
await client.indices.create({
index: 'products',
body: {
settings: {
number_of_shards: 1,
number_of_replicas: 0,
analysis: {
analyzer: {
custom_analyzer: {
type: 'custom',
tokenizer: 'standard',
filter: ['lowercase', 'asciifolding'],
},
},
},
},
mappings: {
properties: {
name: {
type: 'text',
analyzer: 'custom_analyzer',
fields: {
keyword: { type: 'keyword' },
},
},
description: { type: 'text' },
price: { type: 'float' },
category: { type: 'keyword' },
tags: { type: 'keyword' },
inStock: { type: 'boolean' },
createdAt: { type: 'date' },
location: { type: 'geo_point' },
},
},
},
});
Index Operations
// Check if exists
const exists = await client.indices.exists({ index: 'products' });
// Get mapping
const mapping = await client.indices.getMapping({ index: 'products' });
// Update mapping (add fields only)
await client.indices.putMapping({
index: 'products',
body: {
properties: {
newField: { type: 'keyword' },
},
},
});
// Delete index
await client.indices.delete({ index: 'products' });
// Reindex
await client.reindex({
body: {
source: { index: 'products' },
dest: { index: 'products_v2' },
},
});
Document Operations
CRUD
// Index document
await client.index({
index: 'products',
id: '1', // optional, auto-generated if not provided
body: {
name: 'iPhone 15',
description: 'Latest Apple smartphone',
price: 999.99,
category: 'electronics',
tags: ['phone', 'apple', 'smartphone'],
inStock: true,
createdAt: new Date(),
},
});
// Get document
const doc = await client.get({ index: 'products', id: '1' });
// Update document
await client.update({
index: 'products',
id: '1',
body: {
doc: { price: 899.99, inStock: false },
},
});
// Delete document
await client.delete({ index: 'products', id: '1' });
Bulk Operations
const products = [
{ name: 'Product 1', price: 10 },
{ name: 'Product 2', price: 20 },
{ name: 'Product 3', price: 30 },
];
const body = products.flatMap((doc, i) => [
{ index: { _index: 'products', _id: String(i + 1) } },
doc,
]);
const { body: bulkResponse } = await client.bulk({ body, refresh: true });
if (bulkResponse.errors) {
const erroredDocuments = bulkResponse.items.filter(
(item: any) => item.index?.error
);
console.error('Bulk errors:', erroredDocuments);
}
Search
Basic Search
const result = await client.search({
index: 'products',
body: {
query: {
match: { name: 'iphone' },
},
},
});
console.log(result.hits.hits); // Array of matching documents
console.log(result.hits.total); // Total count
Query Types
// Match (full-text search)
{ match: { name: 'iphone pro' } }
// Match phrase
{ match_phrase: { name: 'iphone pro' } }
// Multi-match (search multiple fields)
{
multi_match: {
query: 'iphone',
fields: ['name^2', 'description'], // name has 2x weight
}
}
// Term (exact match for keywords)
{ term: { category: 'electronics' } }
// Terms (multiple exact values)
{ terms: { category: ['electronics', 'phones'] } }
// Range
{ range: { price: { gte: 100, lte: 500 } } }
// Bool (combine queries)
{
bool: {
must: [{ match: { name: 'iphone' } }],
filter: [
{ term: { inStock: true } },
{ range: { price: { lte: 1000 } } }
],
should: [{ term: { category: 'electronics' } }],
must_no
Установить elasticsearch в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditВложенные файлы
FAQ
Что делает скилл elasticsearch?
Elasticsearch search and analytics engine. Full-text search, aggregations, document store. Use when implementing search functionality or log analytics. USE WHEN: user mentions "elasticsearch", "full-text search", "search indexing", "log analytics", "ELK stack", "aggregations", "faceted search", "autocomplete", "suggestions" DO NOT USE FOR: primary database - use `postgresql` or `mongodb` instead, caching - use `redis` instead, ACID transactions - use SQL databases instead
Как установить скилл elasticsearch?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл elasticsearch запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic