重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
elasticsearch-expert by personamanagmentlayer/pcl
npx skills add https://github.com/personamanagmentlayer/pcl --skill elasticsearch-expert提供 Elasticsearch、搜索优化、ELK 栈和分布式搜索系统的专家指导。
from elasticsearch import Elasticsearch
es = Elasticsearch(['http://localhost:9200'])
# 创建索引并指定映射
mapping = {
"mappings": {
"properties": {
"title": {"type": "text", "analyzer": "english"},
"content": {"type": "text"},
"author": {"type": "keyword"},
"created_at": {"type": "date"},
"views": {"type": "integer"}
}
}
}
es.indices.create(index='articles', body=mapping)
# 索引文档
doc = {
"title": "Elasticsearch Guide",
"content": "Complete guide to Elasticsearch",
"author": "John Doe",
"created_at": "2024-01-01",
"views": 100
}
es.index(index='articles', id=1, body=doc)
# 批量索引
from elasticsearch.helpers import bulk
actions = [
{"_index": "articles", "_id": i, "_source": doc}
for i, doc in enumerate(documents)
]
bulk(es, actions)
# 全文搜索
query = {
"query": {
"match": {
"content": "elasticsearch guide"
}
}
}
results = es.search(index='articles', body=query)
# 布尔查询
bool_query = {
"query": {
"bool": {
"must": [
{"match": {"content": "elasticsearch"}}
],
"filter": [
{"range": {"views": {"gte": 100}}}
],
"should": [
{"term": {"author": "john-doe"}}
],
"must_not": [
{"term": {"status": "draft"}}
]
}
}
}
# 多字段匹配查询
multi_match = {
"query": {
"multi_match": {
"query": "elasticsearch guide",
"fields": ["title^2", "content"], # 提升标题权重
"type": "best_fields"
}
}
}
# 模糊搜索
fuzzy = {
"query": {
"fuzzy": {
"title": {
"value": "elasticseerch",
"fuzziness": "AUTO"
}
}
}
}
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 聚合查询
agg_query = {
"aggs": {
"authors": {
"terms": {
"field": "author",
"size": 10
}
},
"avg_views": {
"avg": {
"field": "views"
}
},
"views_histogram": {
"histogram": {
"field": "views",
"interval": 100
}
},
"date_histogram": {
"date_histogram": {
"field": "created_at",
"calendar_interval": "month"
}
}
}
}
result = es.search(index='articles', body=agg_query)
❌ 使用 from/size 进行深度分页 ❌ 无前缀的通配符查询 ❌ 没有副本分片 ❌ 过度分片 ❌ 精确匹配时不使用过滤器 ❌ 忽略集群黄色/红色状态
每周安装数
62
代码仓库
GitHub 星标数
11
首次出现
2026年1月24日
安全审计
安装于
codex55
opencode54
gemini-cli49
github-copilot46
cursor45
kimi-cli43
Expert guidance for Elasticsearch, search optimization, ELK stack, and distributed search systems.
from elasticsearch import Elasticsearch
es = Elasticsearch(['http://localhost:9200'])
# Create index with mapping
mapping = {
"mappings": {
"properties": {
"title": {"type": "text", "analyzer": "english"},
"content": {"type": "text"},
"author": {"type": "keyword"},
"created_at": {"type": "date"},
"views": {"type": "integer"}
}
}
}
es.indices.create(index='articles', body=mapping)
# Index document
doc = {
"title": "Elasticsearch Guide",
"content": "Complete guide to Elasticsearch",
"author": "John Doe",
"created_at": "2024-01-01",
"views": 100
}
es.index(index='articles', id=1, body=doc)
# Bulk indexing
from elasticsearch.helpers import bulk
actions = [
{"_index": "articles", "_id": i, "_source": doc}
for i, doc in enumerate(documents)
]
bulk(es, actions)
# Full-text search
query = {
"query": {
"match": {
"content": "elasticsearch guide"
}
}
}
results = es.search(index='articles', body=query)
# Boolean query
bool_query = {
"query": {
"bool": {
"must": [
{"match": {"content": "elasticsearch"}}
],
"filter": [
{"range": {"views": {"gte": 100}}}
],
"should": [
{"term": {"author": "john-doe"}}
],
"must_not": [
{"term": {"status": "draft"}}
]
}
}
}
# Multi-match query
multi_match = {
"query": {
"multi_match": {
"query": "elasticsearch guide",
"fields": ["title^2", "content"], # Boost title
"type": "best_fields"
}
}
}
# Fuzzy search
fuzzy = {
"query": {
"fuzzy": {
"title": {
"value": "elasticseerch",
"fuzziness": "AUTO"
}
}
}
}
# Aggregation query
agg_query = {
"aggs": {
"authors": {
"terms": {
"field": "author",
"size": 10
}
},
"avg_views": {
"avg": {
"field": "views"
}
},
"views_histogram": {
"histogram": {
"field": "views",
"interval": 100
}
},
"date_histogram": {
"date_histogram": {
"field": "created_at",
"calendar_interval": "month"
}
}
}
}
result = es.search(index='articles', body=agg_query)
❌ Deep pagination with from/size ❌ Wildcard queries without prefix ❌ No replica shards ❌ Over-sharding ❌ Not using filters for exact matches ❌ Ignoring cluster yellow/red status
Weekly Installs
62
Repository
GitHub Stars
11
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex55
opencode54
gemini-cli49
github-copilot46
cursor45
kimi-cli43
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
111,700 周安装