REST
Query Rest
The parameter pretty=false can be added to create compressed output on many of the calls
Simple Query
http://localhost:32192/query?&index=pubs&q=title:gene&rows=10
Simple Query in csv
CSV output is served from the /query/csv path (there is no format parameter):
http://localhost:32192/query/csv?index=pubs&q=title:gene&rows=10&fl=id&fl=title
Multiple and Wildcard Indexes
Repeat the index parameter to query several indexes at once, and use * / ? wildcards to match index names by pattern:
http://localhost:32192/query?index=pubs&index=news&q=title:gene&rows=10
http://localhost:32192/query?index=logs-*&q=error&rows=10
Return Fields
http://localhost:32192/query?&index=pubs&q=title:gene&rows=10&fl=title
Filter Fields Returned
http://localhost:32192/query?&q=title:gene&rows=10&fl=-doi&fl=-abstract
Facet
http://localhost:32192/query?&index=pubs&facet=issn
Facet (More Results)
http://localhost:32192/query?&index=pubs&facet=issn:100
Facet Drill Down
http://localhost:32192/query?&index=pubs&facet=issn:100&drillDown=issn:1234-1234
Query Fields
http://localhost:32192/query?&index=pubs&q=cancer&qf=title&qf=abstract&rows=10
Minimum should match / Default Query Operator Example
http://localhost:32192/query?&index=pubs&q=gene biology genotype&qf=title&qf=abstract&mm=2&defaultOp=OR&rows=10
Sort
Can use -1/DESC or 1/ASC and multiple sort parameters to sort on for example title and then date
http://localhost:32192/query?&index=pubs&sort=title:-1&rows=10
Filter Query
http://localhost:32192/query?index=pubs&q=*:*&fq=title:cancer&rows=10
Advanced Filter Query
A filter clause with its own query fields, default operator, and minimum-should-match is expressed with qJson using "queryType":"FILTER" (there is no fqJson parameter):
http://localhost:32192/query?index=pubs&q=*:*&qJson={"queryType":"FILTER","q":"cancer diabetes genes","defaultOp":"OR","mm":2,"qf":["title","abstract"]}&rows=10
Score Function Query
Score functions are passed via the qJson parameter using the protobuf JSON format:
http://localhost:32192/query?index=pubs&rows=10&qJson={"queryType":"SCORE_MUST","q":"title:gene","scoreFunction":"zuliaScore * popularity"}
Multiple query clauses can be combined using multiple qJson parameters:
http://localhost:32192/query?index=pubs&rows=10&qJson={"queryType":"SCORE_MUST","q":"title:gene","qf":["title"],"scoreFunction":"zuliaScore * (1 + ln(pageRank))"}&qJson={"queryType":"FILTER","q":"year:[2020 TO *]"}
See Query-Syntax for the full expression reference.
More Like This Query
A MORE_LIKE_THIS clause finds documents similar to one or more sources (existing document IDs and/or raw text). It is expressed with qJson (see the Java Client for modes and tuning parameters):
# similar to an existing document, judged on the title and abstract fields
http://localhost:32192/query?index=pubs&rows=10&qJson={"queryType":"MORE_LIKE_THIS","moreLikeThisParams":{"documentId":["someDocId"],"field":["title","abstract"]}}
# similar to free text
http://localhost:32192/query?index=pubs&rows=10&qJson={"queryType":"MORE_LIKE_THIS","moreLikeThisParams":{"likeText":["CRISPR gene editing in agriculture"],"field":["title","abstract"]}}
By default the source documents are excluded from the results; add "includeSourceDocs":true inside moreLikeThisParams to keep them.
Realtime Query
Triggers an NRT (Near Real-Time) refresh to include recently stored but uncommitted documents in the results.
http://localhost:32192/query?index=pubs&q=title:gene&rows=10&realtime=true
Debug
Logs the parsed and rewritten Lucene query for each shard in the server logs. Useful for troubleshooting query behavior.
http://localhost:32192/query?index=pubs&q=title:gene&rows=10&debug=true
Concurrency
Sets the number of virtual threads used for parallel segment search within each shard. Defaults to the index or node-level defaultConcurrency setting if not specified.
http://localhost:32192/query?index=pubs&q=title:gene&rows=10&concurrency=4
Cursor Pagination
Cursor pagination provides constant-time paging regardless of depth. A sort on a unique field or unique combination is required, especially on a changing index where documents may be added or updated between pages.
Start pagination with cursor=0:
http://localhost:32192/query?index=pubs&q=title:gene&rows=10&sort=id:1&cursor=0
The response includes a cursor field (Base64-encoded token). Pass it back to get the next page:
http://localhost:32192/query?index=pubs&q=title:gene&rows=10&sort=id:1&cursor=CgwKCW15aW5kZXgS...
Repeat until the results array is empty.
Batch request
Batch mode streams all results as CSV using cursor pagination internally. A sort is required.
http://localhost:32192/query?&index=pubs&q=title:gene&rows=10&batch=true&batchSize=1000
Fields Rest
http://localhost:32192/fields/pubs
The query parameter style is also supported but the path-based style above is preferred:
http://localhost:32192/fields?index=pubs
Realtime Fields
http://localhost:32192/fields/pubs?realtime=true
Indexes Rest
http://localhost:32192/indexes
Index Schema Rest
http://localhost:32192/index?index=someIndex
Nodes Rest
http://localhost:32192/nodes
Stats Rest
http://localhost:32192/stats
Fetch Rest
http://localhost:32192/fetch?index=pubs&id=13442
Realtime Fetch
http://localhost:32192/fetch?index=pubs&id=13442&realtime=true
Terms Rest
All terms endpoints also accept realtime=true to include uncommitted changes.
All Terms for a field
http://localhost:32192/terms?index=pubs&fl=title
Terms with CSV Format
CSV output is served from the /terms/csv path (there is no format parameter):
http://localhost:32192/terms/csv?index=pubs&fl=title
Terms With Minimum Term Frequency
http://localhost:32192/terms?index=pubs&fl=title&minTermFreq=5000
Fuzzy Match of Terms
http://localhost:32192/terms?index=pubs&fl=abstract&fuzzyTermJson={"term":"gene","editDistance":1,"prefixLength":3}
Limit Terms
http://localhost:32192/terms?index=pubs&fl=title&minDocFreq=1000&amount=20
Range of Terms
http://localhost:32192/terms?index=pubs&fl=title&startTerm=cancer&endTerm=cells
Specific Terms
http://localhost:32192/terms?index=pubs&fl=abstract&includeTerm=cancer&includeTerm=gene
Associated Rest
Associated files use path-based routes under /associated/{index}/{id}/{fileName}.
Fetch a file
http://localhost:32192/associated/someIndex/123/readme.txt/file
Fetch a file’s metadata
http://localhost:32192/associated/someIndex/123/readme.txt/metadata
List the filenames for a document
http://localhost:32192/associated/someIndex/123/filenames
Download all files for a document as a zip
http://localhost:32192/associated/someIndex/123/bundle
List all associated documents in an index
Optionally filter with a q query parameter:
http://localhost:32192/associated/someIndex/all
http://localhost:32192/associated/someIndex/all?q=fileName:readme.txt
Store a file
POST the file as multipart form-data (a file part, plus an optional metaJson part) to the same path used to fetch it. Send the metaJson part before the file part so the server can bind the metadata alongside the streamed file:
curl -F 'metaJson={"author":"jane"}' -F "file=@readme.txt" \
http://localhost:32192/associated/someIndex/123/readme.txt
Replication Rest
Reports per-shard and per-replica segment-replication progress for an index (cluster mode). Useful for monitoring replica lag and circuit-breaker state.
http://localhost:32192/replication/someIndex
Example response:
[
{
"shardNumber": 0,
"lastAttemptedGeneration": 42,
"replicas": [
{
"serverAddress": "10.0.0.51",
"servicePort": 32191,
"lastReplicatedGeneration": 42,
"lagGenerations": 0,
"lastSuccessMs": 1716900000000,
"msSinceLastSuccess": 1200,
"consecutiveFailures": 0,
"circuitOpen": false,
"backoffUntilMs": 0
}
]
}
]
Health Rest
Returns the health status of the Zulia node including CPU usage, memory usage, disk space, and MongoDB connectivity (cluster mode only). Each indicator reports UP, DEGRADED, or DOWN with detailed metrics.
Example Usage
curl http://localhost:32192/health
Example response:
{
"name": "zulia-service",
"status": "UP",
"details": {
"cpuUsage": {
"name": "zulia-service",
"status": "UP",
"details": {
"system": "13.67%",
"systemAlertThreshold": "90.01%",
"jvm": "0.93%",
"jvmAlertThreshold": "80.00%",
"numProcessors": 16
}
},
"memoryUsage": {
"name": "zulia-service",
"status": "UP",
"details": {
"memoryUsed": "131.8 MiB",
"memoryMax": "30 GiB",
"memoryCommitted": "160 MiB",
"memoryPercent": "0.43%",
"thresholdPercent": "90.00%"
}
},
"compositeDiscoveryClient()": {
"name": "zulia-service",
"status": "UP",
"details": {
"services": {
}
}
},
"service": {
"name": "zulia-service",
"status": "UP"
},
"diskSpace": {
"name": "zulia-service",
"status": "UP",
"details": {
"total": 7998551654400,
"free": 7447839285248,
"threshold": 1073741824
}
},
"deadlockedThreads": {
"name": "zulia-service",
"status": "UP"
},
"mongoStatus": {
"name": "zulia-service",
"status": "UP",
"details": {
"statusDetails": "Able to connect to Mongo instance"
}
},
"gracefulShutdown": {
"name": "zulia-service",
"status": "UP",
"details": {
"activeTasks": 2
}
}
}
}