Skip to main content

Publish your first index

An index is the unit you expose. Create it, write to it, and every peer on your mesh can route queries to it.

Create it​

gnarl index create imagery --field title:text --field sensor:keyword
▸ created imagery (tantivy, 4 claim(s))

--field is repeatable and takes NAME:TYPE. An index is split across claims — the unit of replication — so the count tells you how many pieces the mesh will spread and replicate.

Field types include text, keyword, date, boolean, numeric types, and dense_vector. A few types (geo_point among them) need the optional Java classpath; see configuration.

Reserved names

id, version, title, and canonical_url are built-in document fields. The node refuses a schema that declares them.

Check what you declared​

gnarl index show imagery
▸ imagery
title text
sensor keyword

Write documents​

Documents go in over HTTP — there is no single-document CLI verb yet.

curl -X POST http://localhost:8080/v1/indexes/imagery/_doc \
-H 'content-type: application/json' \
-d '{"title": "Puget Sound, cloud-free", "sensor": "sentinel-2"}'

For bulk loads, post newline-delimited documents to /v1/indexes/imagery/_bulk. See the Query API.

gnarl index count imagery
▸ imagery 1 doc(s)

If the count says PARTIAL, some claims did not answer — that is the mesh being honest, not an error.

Search it​

gnarl search "cloud-free" --index imagery --explain

From another node on the same mesh, the same query routes to whoever can answer it. Add --require-complete when a partial answer is not acceptable:

gnarl search "cloud-free" --index imagery --require-complete

Clean up​

gnarl index delete imagery

Deletion tombstones propagate across claims, so a peer may serve the index for a moment after the command returns.

Next​