Elasticsearch Demo Queries
Pre-tested queries for the live demonstration. Copy and paste these into Kibana Dev Tools during the presentation.
Setup Verification
Check Index Exists
GET jupiter-documentation
Count Total Documents
GET jupiter-documentation/_count
Get Index Mapping
GET jupiter-documentation/_mapping
Demo Query 1: Repository Overview
Get All Documents from Comparables Repo
GET jupiter-documentation/_search
{
"query": {
"term": {
"repository.keyword": "Jupiter.Market.Elastic.Comparables"
}
},
"size": 5,
"_source": ["title", "type", "url", "repository", "namespace", "className"]
}
Expected Results: 5 documents from the Comparables repository
Point Out:
- Repository field
- Document types (api, article)
- URLs
- Namespace/class structure
Demo Query 2: Document Type Breakdown
Count by Document Type
GET jupiter-documentation/_search
{
"size": 0,
"aggs": {
"by_type": {
"terms": {
"field": "type.keyword"
}
}
}
}
Expected Results: Aggregation showing count of "api" vs "article" documents
Point Out:
- API reference documents
- Conceptual articles
- Distribution across types
Demo Query 3: Full-Text Search
Search for IndexerService
GET jupiter-documentation/_search
{
"query": {
"multi_match": {
"query": "IndexerService pipeline orchestration",
"fields": ["title^2", "content", "className"]
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 150,
"number_of_fragments": 3
},
"title": {}
}
},
"size": 3,
"_source": ["title", "type", "url", "namespace", "className"]
}
Expected Results: Documents about IndexerService with highlighted matches
Point Out:
- Multi-field search
- Title boosting (^2 means title matches score higher)
- Highlighted fragments
- Relevance scoring
Demo Query 4: Namespace Search
Find All Services
GET jupiter-documentation/_search
{
"query": {
"bool": {
"must": [
{ "term": { "type": "api" } }
],
"filter": [
{ "wildcard": { "namespace.keyword": "*Services*" } }
]
}
},
"size": 10,
"_source": ["title", "namespace", "className", "url"]
}
Expected Results: All service classes
Point Out:
- Namespace filtering
- API-only results
- Service layer classes
Demo Query 5: Article Search
Find Articles About Data Processing
GET jupiter-documentation/_search
{
"query": {
"bool": {
"must": [
{ "match": { "content": "data processing" } }
],
"filter": [
{ "term": { "type": "article" } }
]
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 200,
"number_of_fragments": 2
}
}
},
"size": 5,
"_source": ["title", "url", "tags"]
}
Expected Results: Articles discussing data processing
Point Out:
- Article-only filter
- Content matching
- Tags for categorization
- Highlighted context
Demo Query 6: Tag-Based Search
Find Documents by Tag
GET jupiter-documentation/_search
{
"query": {
"term": {
"tags.keyword": "indexing"
}
},
"size": 5,
"_source": ["title", "type", "tags", "url"]
}
Expected Results: Documents tagged with "indexing"
Point Out:
- Tag-based discovery
- Cross-document relationships
- Topic clustering
Demo Query 7: Complex Boolean Query
Find API Docs About Services with Specific Content
GET jupiter-documentation/_search
{
"query": {
"bool": {
"must": [
{ "match": { "content": "async await" } }
],
"filter": [
{ "term": { "type": "api" } },
{ "term": { "repository.keyword": "Jupiter.Market.Elastic.Comparables" } },
{ "wildcard": { "namespace.keyword": "*Services*" } }
]
}
},
"highlight": {
"fields": {
"content": {}
}
},
"size": 5,
"_source": ["title", "namespace", "className", "url"]
}
Expected Results: Service classes using async/await
Point Out:
- Multiple filters combined
- Content + metadata search
- Precise targeting
Demo Query 8: Recent Updates
Find Recently Modified Documents
GET jupiter-documentation/_search
{
"query": {
"range": {
"lastModified": {
"gte": "now-7d"
}
}
},
"sort": [
{ "lastModified": { "order": "desc" } }
],
"size": 5,
"_source": ["title", "type", "lastModified", "url"]
}
Expected Results: Documents modified in last 7 days
Point Out:
- Timestamp tracking
- Recent changes
- Sorted by date
Demo Query 9: Aggregations - Repository Distribution
Count Documents per Repository
GET jupiter-documentation/_search
{
"size": 0,
"aggs": {
"by_repository": {
"terms": {
"field": "repository.keyword",
"size": 10
},
"aggs": {
"by_type": {
"terms": {
"field": "type.keyword"
}
}
}
}
}
}
Expected Results: Document count per repository, broken down by type
Point Out:
- Multi-repository view
- Nested aggregations
- Documentation coverage
Demo Query 10: Fuzzy Search
Find Documents with Typo Tolerance
GET jupiter-documentation/_search
{
"query": {
"multi_match": {
"query": "Indxer Servce",
"fields": ["title", "className", "content"],
"fuzziness": "AUTO"
}
},
"size": 3,
"_source": ["title", "className", "url"]
}
Expected Results: Finds "IndexerService" despite typos
Point Out:
- Fuzzy matching
- Typo tolerance
- User-friendly search
Demo Query 11: Phrase Search
Find Exact Phrases
GET jupiter-documentation/_search
{
"query": {
"match_phrase": {
"content": "orchestrates the end-to-end indexing pipeline"
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 200
}
}
},
"size": 3,
"_source": ["title", "url"]
}
Expected Results: Documents containing exact phrase
Point Out:
- Exact phrase matching
- Precise search
- Context preservation
Demo Query 12: Cross-Repository Search
Search Across All Repositories
GET jupiter-documentation/_search
{
"query": {
"multi_match": {
"query": "elasticsearch indexing",
"fields": ["title^2", "content"]
}
},
"aggs": {
"repositories": {
"terms": {
"field": "repository.keyword"
}
}
},
"size": 5,
"_source": ["title", "repository", "type", "url"]
}
Expected Results: Results from multiple repositories
Point Out:
- Cross-repository search
- Unified knowledge base
- Repository aggregation
Troubleshooting Queries
Check Document Structure
GET jupiter-documentation/_search
{
"size": 1
}
Get Specific Document by ID
GET jupiter-documentation/_doc/[document-id]
Search with Explain
GET jupiter-documentation/_search
{
"query": {
"match": {
"title": "IndexerService"
}
},
"explain": true,
"size": 1
}
Performance Queries
Profile Query Performance
GET jupiter-documentation/_search
{
"profile": true,
"query": {
"multi_match": {
"query": "IndexerService",
"fields": ["title", "content"]
}
},
"size": 5
}
Point Out:
- Query execution time
- Performance metrics
- Optimization opportunities
Quick Reference: Common Patterns
Basic Search
GET jupiter-documentation/_search
{
"query": {
"match": { "content": "your search term" }
}
}
Filtered Search
GET jupiter-documentation/_search
{
"query": {
"bool": {
"must": [{ "match": { "content": "search term" } }],
"filter": [{ "term": { "type": "api" } }]
}
}
}
Aggregation
GET jupiter-documentation/_search
{
"size": 0,
"aggs": {
"my_agg": {
"terms": { "field": "fieldname.keyword" }
}
}
}
Highlighting
GET jupiter-documentation/_search
{
"query": { "match": { "content": "search term" } },
"highlight": {
"fields": { "content": {} }
}
}
Demo Flow Recommendation
Suggested Order for Presentation:
- Query 1 - Show repository overview
- Query 3 - Demonstrate full-text search with highlighting
- Query 7 - Show complex filtering
- Query 9 - Display aggregations
- Query 10 - Demonstrate fuzzy search (impressive!)
Time: ~3 minutes total
Backup Queries (If Time Permits)
Find All Mappers
GET jupiter-documentation/_search
{
"query": {
"wildcard": {
"className.keyword": "*Mapper"
}
},
"size": 10,
"_source": ["className", "namespace", "url"]
}
Find All Helper Classes
GET jupiter-documentation/_search
{
"query": {
"wildcard": {
"className.keyword": "*Helper"
}
},
"size": 10,
"_source": ["className", "namespace", "url"]
}
End of Demo Queries
Tips:
- Test all queries before presentation
- Have results ready in separate tab
- Know expected result counts
- Prepare for "no results" scenarios