Skip to content

Raw Query

POST /:handle/query

Forwards a raw Elasticsearch query DSL body to the configured index and returns the raw Elasticsearch response. Use this when you need full control over the query.

ParameterTypeDescription
handlestringIndex handle as configured in config.yaml

A JSON object containing a valid Elasticsearch query DSL body:

{
"query": {
"bool": {
"must": [
{ "match": { "title": "castle" } }
],
"filter": [
{ "term": { "placeCountry": "Scotland" } }
]
}
},
"size": 5
}

Returns the raw Elasticsearch search response, including hits, _shards, took, etc.

Terminal window
curl -X POST "https://search-api-elysia-production.up.railway.app/collections/query" \
-H "Content-Type: application/json" \
-d '{
"query": { "match_all": {} },
"size": 1
}'
Terminal window
# Aggregation query
curl -X POST "https://search-api-elysia-production.up.railway.app/collections/query" \
-H "Content-Type: application/json" \
-d '{
"size": 0,
"aggs": {
"countries": {
"terms": { "field": "placeCountry", "size": 10 }
}
}
}'
StatusCondition
401Missing or invalid bearer token
404Index handle not found