API Reference v1.3.7

Enterprise-gradeElasticSearch API Gateway

Transparent proxy, intelligent query protection, unified search interface, cross-cluster support, monitoring & logging
Server Address: http://localhost:8000

v1.3.6 Index Access Control
v1.3.6 Query Result Caching
v1.3.7 Performance Metrics Collection
v1.3.7 Query Logging

API Categories

ElasticProxy provides four types of API interfaces, supporting complete solutions from basic proxy to enterprise-level features

Core Proxy API

v1.0+

Fully compatible Elasticsearch transparent proxy supporting all HTTP methods and query protection

GET/health

Service health check

curl -X GET "http://localhost:8000/health"
ANY/*

Transparently proxy all Elasticsearch API requests

curl -X POST "http://localhost:8000/test-index/_search" -H "Content-Type: application/json" -d '{"query": {"match_all": {}}}'
POST/{cluster}:{index}/_search

Cross-cluster search (CCS) support

curl -X POST "http://localhost:8000/logs:test-index/_search" -H "Content-Type: application/json" -d '{"query": {"match": {"message": "error"}}}'
GET/_cat/indices?v

Cat API automatic format handling

curl -X GET "http://localhost:8000/_cat/indices?v"
POST/{index}/_search?scroll=1m

Scroll search support

curl -X POST "http://localhost:8000/test-index/_search?scroll=1m" -H "Content-Type: application/json" -d '{"query": {"match_all": {}}, "size": 1000}'

Management API

v1.0+

System management, monitoring, configuration hot reload and cache control interfaces

GET/actuator/health

Detailed health check

curl -X GET "http://localhost:8000/actuator/health"
POST/actuator/refresh

Configuration hot reload

curl -X POST "http://localhost:8000/actuator/refresh"
GET/actuator/prometheus

Prometheus monitoring metrics

curl -X GET "http://localhost:8000/actuator/prometheus"

Unified Search Management API

v1.3.7+

Performance metrics collection, cache management and other advanced features

GET/actuator/unified-search/metrics

Get unified search performance metrics summary

curl -X GET "http://localhost:8000/actuator/unified-search/metrics"
GET/actuator/unified-search/metrics/detailed

Get detailed performance metrics

curl -X GET "http://localhost:8000/actuator/unified-search/metrics/detailed"
GET/actuator/unified-search/cache/stats

Query cache statistics

curl -X GET "http://localhost:8000/actuator/unified-search/cache/stats"
POST/actuator/unified-search/cache/clear

Clear query cache

curl -X POST "http://localhost:8000/actuator/unified-search/cache/clear"

Unified Search Interface Guide

Intelligent query type recognition, automatic parameter validation, enterprise feature integration

Query Type Auto-Recognition Rules

🎯

Exact Match Query

Field name in exactMatchFields configuration list, or value is pure number/simple identifier

corpId: "FUND002"
πŸ“Š

Range Query

Field name in rangeFields configuration list, and value contains comma-separated format

bizDate: "2023-01-01,2023-12-31"
πŸ”

Text Search

Other cases default to text search, supports tokenization and relevance scoring

description: "fund investment"

Business Rule Limits

Maximum conditions
50

Maximum of 50 query conditions per single query

Pagination window
from + size ≀ 10000

Prevent performance issues caused by deep pagination

Relationship type
AND/OR

Only supports AND and OR condition relationship types

Query timeout
30 seconds

Maximum execution time per single query (configurable)

Index access
allowedIndices config

Restricted by index access control list

API Usage Examples

Exact Match Query

term

Term query - field name in exact match list, or value is pure number/simple identifier

Range Query

range

Range query - field name in range field list, value contains comma-separated format "start,end"

Text Search

match

Match query - other cases default to text search, supports tokenization and relevance scoring

Multi-condition Boolean Query

bool

AND/OR relationship types, supports mixed query types

Cross-cluster Search

cross_cluster

Supports CCS alias routing for cross-cluster queries

Response Format Description

Standard field description of unified search API response

code
string

HTTP status code string ("200"/"400"/"403"/"404"/"500")

message
string

Response message ("Success" for success, specific error message for errors)

data
array

Document array containing actual data of query results

total
number

Total record count

took
number

Query execution time (milliseconds)

Security & Rate Limiting

Enterprise-level security protection and access control mechanisms

IP Access Control

Supports whitelist and blacklist, CIDR format network segment control

Rate Limiting

IP-based request frequency limiting

Query Protection

7 intelligent protection rules to prevent dangerous queries

Monitoring & Logging

Complete request tracking and performance monitoring system

Request Logs

Elasticsearch monitoring index: elastic-proxy-logs-YYYY-MM-DD

Main Fields

timestampclient_ipmethodpathstatus_codedurationquery_analysis

Unified Search Logs

Elasticsearch monitoring index: unified-search-logs-YYYY-MM-DD

Main Fields

query_idtimestampclient_ipindex_pathexecution_time_msresult_countcache_hit

v1.3.7 Enhanced Monitoring Features

Professional-grade performance metrics collection based on Micrometer

Performance Metrics

Request volume, success rate, response time

Cache Monitoring

Hit rate, size, cleanup statistics

Query Audit

Detailed query logging

System Monitoring

JVM, connection pool, ES cluster status

Error Code Reference

HTTP status codes, error reasons and response examples

200

Success

Request successful

{"code":"200","message":"Success","description":"Request successful"}
400

Bad Request

Request parameter validation failed

{"code":"400","message":"Bad Request","description":"Request parameter validation failed"}
403

Forbidden

IP not in whitelist, insufficient index access permission

{"code":"403","message":"Forbidden","description":"IP not in whitelist, insufficient index access permission"}
404

Not Found

Resource does not exist

{"code":"404","message":"Not Found","description":"Resource does not exist"}
429

Too Many Requests

Request too frequent

{"code":"429","message":"Too Many Requests","description":"Request too frequent"}
500

Internal Server Error

Internal server error

{"code":"500","message":"Internal Server Error","description":"Internal server error"}

πŸš€ v1.3.7 Major Features

Performance metrics collection, query logging, strict type detection - Enterprise monitoring system

πŸ“Š Performance Metrics Collection

Professional-grade performance monitoring based on Micrometer, comprehensive coverage of request volume, success rate, response time

# Get performance metrics summary
curl http://localhost:8000/actuator/unified-search/metrics

# Get detailed metrics
curl http://localhost:8000/actuator/unified-search/metrics/detailed

πŸ“ Query Logging

Detailed unified search query audit, supports query analysis, cache monitoring, execution time statistics

# Enable query logging
proxy:
  unified-search:
    enableQueryLogging: true
    
# Log index: unified-search-logs-YYYY-MM-DD

🎯 Strict Type Detection

Intelligent query type inference strategy, supports automatic recognition of exact match, range query, text search

# Configure strict type detection
proxy:
  unified-search:
    strictTypeDetection: true
    exactMatchFields: ["id", "status"]
    rangeFields: ["date", "timestamp"]

πŸ” Index Access Control v1.3.6

Fine-grained index access permission control, supports exact match, wildcard match, cross-cluster index format

proxy:
  unified-search:
    allowedIndices: ["logs-*", "metrics-*", "business-*"]

⚑ Query Result Caching v1.3.6

Significantly improves query performance (80-95% response time improvement), reduces ES cluster load (60-80%)

# Cache statistics
curl http://localhost:8000/actuator/unified-search/cache/stats