// use with VSC extension "Rest client" to execute API calls and inspect responses
### individual API key (use create api key below to generate)
@api_key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
// WARNING: make sure to set the MASTER_KEY_SECRET environment variable to a secret,
// otherwise your generated API keys will be compromised.
### create api key (use master API key displayed in the server console at startup)
POST http://127.0.0.1:80/api/v1/apikey HTTP/1.1
apikey: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=
content-type: application/json
{
"indices_max": 10,
"indices_size_max":100000,
"documents_max":10000000,
"operations_max":10000000,
"rate_limit": 100000
}
### delete api key
DELETE http://127.0.0.1/api/v1/apikey HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### create index
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": true,
"boost":10.0
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": true,
"longest": true
},
{
"field": "url",
"field_type": "String32",
"store": true,
"index_lexical": false
}],
"index_name": "test_index",
"similarity": "Bm25fProximity",
"tokenizer": "UnicodeAlphanumeric"
}
### get index
GET http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### get all indexes (per apikey)
### get all indices (per server - requires master apikey)
### delete index
DELETE http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### commit index
PATCH http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### index document
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"title":"title1 test",
"body":"body1",
"url":"url1"
}
### index documents
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[
{
"title":"title2",
"body":"body2 test",
"url":"url2"
},
{
"title":"title3 test",
"body":"body3 test",
"url":"url3"
}
]
### get documents with highlight
GET http://127.0.0.1/api/v1/index/0/doc/0
apikey: {{api_key}}
content-type: application/json
//optional request body
{
"query_terms": ["test"],
"fields": ["title", "body"],
"highlights": [
{ "field": "title", "fragment_number": 0, "fragment_size": 1000, "highlight_markup": true},
{ "field": "body", "fragment_number": 2, "fragment_size": 160, "highlight_markup": true},
{ "field": "body", "name": "body2", "fragment_number": 0, "fragment_size": 4000, "highlight_markup": true}]
}
### get document without highlight
GET http://127.0.0.1/api/v1/index/0/doc/0
apikey: {{api_key}}
content-type: application/json
### delete document, by single document ID in URL parameter
DELETE http://127.0.0.1/api/v1/index/0/doc/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### delete document, by single document ID in JSON request object
DELETE http://127.0.0.1/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
0
### delete documents, by vector of document IDs in JSON request object
DELETE http://127.0.0.1/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[
0,
1
]
### delete documents, by query in JSON request object
DELETE http://127.0.0.1/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"test",
"offset":0,
"length":10,
"realtime": true,
"field_filter": ["title", "body"]
}
### update document
PATCH http://127.0.0.1/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[0,{"title":"title1 test","body":"body1","url":"url1"}]
### update documents
PATCH http://127.0.0.1/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[[1,{"title":"title1 test","body":"body1","url":"url1"}],
[2,{"title":"title3 test","body":"body3 test","url":"url3"}]]
### query index GET
GET http://127.0.0.1/api/v1/index/0/query
?query=test
&offset=0
&length=10
&realtime=true
apikey: {{api_key}}
content-type: application/json
### query index GET with json request
GET http://127.0.0.1/api/v1/index/0/query
apikey: {{api_key}}
content-type: application/json
{
"query":"test",
"offset":0,
"length":10,
"realtime": true,
"field_filter": ["title", "body"]
}
### query index POST
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"test",
"offset":0,
"length":10,
"result_type": "TopkCount",
"realtime": true,
"field_filter": ["title", "body"]
}
### query index POST with highlight
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"test",
"offset":0,
"length":10,
"realtime": true,
"highlights": [
{ "field": "title", "fragment_number": 0, "fragment_size": 1000, "highlight_markup": true},
{ "field": "body", "fragment_number": 2, "fragment_size": 160, "highlight_markup": true},
{ "field": "body", "name": "body2", "fragment_number": 0, "fragment_size": 4000, "highlight_markup": true}]
}
### create index NUMBER
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": true,
"boost":10.0
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "url",
"field_type": "String32",
"store": true,
"index_lexical": false
},
{
"field": "number",
"field_type": "I64",
"store": true,
"index_lexical": true
}],
"index_name": "test_index",
"similarity": "Bm25fProximity",
"tokenizer": "UnicodeAlphanumeric"
}
### index doc NUMBER
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"title":"title1 test",
"body":"body1",
"url":"url1",
"number": 12345
}
### query index POST with highlight NUMBER
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"12345",
"offset":0,
"length":10,
"realtime": true,
"highlights": [
{ "field": "number", "name":"_number","fragment_number": 0, "fragment_size": 1000, "highlight_markup": true}]
}
### get file
GET http://127.0.0.1/api/v1/index/0/file/0
apikey: {{api_key}}
content-type: application/json
### get synonyms
GET http://127.0.0.1/api/v1/index/0/synonyms
apikey: {{api_key}}
content-type: application/json
### query index POST with query facets and facet filter
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"bm25",
"offset":0,
"length":10,
"realtime":false,
"highlights":[{"field":"title","fragment_number":0,"fragment_size":1000,"highlight_markup":true},
{"field":"body","fragment_number":2,"fragment_size":160,"highlight_markup":true},
{"field":"body","name":"body2","fragment_number":0,"fragment_size":4000,"highlight_markup":true}],
"result_sort":[],
"query_facets":[
{"Timestamp":{"field":"date","range_type":"CountWithinRange",
"ranges":[["1996",820450800],["1997",852073200],["1998",883609200],["1999",915145200],["2000",946681200],["2001",978303600],["2002",1009839600],["2003",1041375600],["2004",1072911600],["2005",1104534000],["2006",1136070000],["2007",1167606000],["2008",1199142000],["2009",1230764400],["2010",1262300400],["2011",1293836400],["2012",1325372400],["2013",1356994800],["2014",1388530800],["2015",1420066800],["2016",1451602800],["2017",1483225200],["2018",1514761200],["2019",1546297200],["2020",1577833200],["2021",1609455600],["2022",1640991600],["2023",1672527600],["2024",1704063600]
]}}],
"facet_filter": [{"Timestamp": {"field": "date","filter": [820450800,1577833200]}}]
}
### iterator: get first 2 documents
GET http://127.0.0.1/api/v1/index/0/doc_id/?document_id=null&skip=0&take=2&include_document=true&fields=["title","body"]
apikey: {{api_key}}
content-type: application/json
### iterator: get first 2 documents
POST http://127.0.0.1/api/v1/index/0/doc_id/
apikey: {{api_key}}
content-type: application/json
//request body
{
"document_id": null,
"skip": 0,
"take": 2,
"include_document": true,
"fields": []
}
### iterator: get last 2 documents
POST http://127.0.0.1/api/v1/index/0/doc_id/
apikey: {{api_key}}
content-type: application/json
//request body
{
"document_id": null,
"skip": 0,
"take": -2,
"include_document": true,
"fields": []
}
### iterator: get next document
POST http://127.0.0.1/api/v1/index/0/doc_id/
apikey: {{api_key}}
content-type: application/json
//request body
{
"document_id": 0,
"skip": 1,
"take": 1,
"include_document": true,
"fields": []
}
### iterator: get previous document
POST http://127.0.0.1/api/v1/index/0/doc_id/
apikey: {{api_key}}
content-type: application/json
//request body
{
"document_id": 1,
"skip": 1,
"take": -1,
"include_document": true,
"fields": []
}
### search enable_empty_query: default (descending)
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"",
"enable_empty_query": true,
"offset":0,
"length":10,
"realtime":false
}
### search enable_empty_query: descending
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"",
"enable_empty_query": true,
"offset":0,
"length":10,
"realtime":false,
"result_sort":[{"field": "_id", "order": "Descending", "base": "None" }]
}
### search enable_empty_query: ascending
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"",
"enable_empty_query": true,
"offset":0,
"length":10,
"realtime":false,
"result_sort":[{"field": "_id", "order": "Ascending", "base": "None" }]
}
//---- JSON Object field
### create index
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": true,
"longest": true
},
{
"field": "json",
"field_type": "Json",
"store": true,
"index_lexical": true
}],
"index_name": "test_index",
"similarity": "Bm25fProximity",
"tokenizer": "UnicodeAlphanumeric"
}
### index document
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"title":"title1 test",
"body":"body1",
"json":{
"region": "US",
"manager": {
"age": 30,
"name": {
"first": "John",
"last": "Smith"
},
"regions": ["north", "west", "south"]
}
}
}
### commit index
PATCH http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### query index POST
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"\"John Smith\"",
"offset":0,
"length":10,
"result_type": "TopkCount",
"realtime": true
}
// amazon.csv
### create index
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "number",
"field_type": "U32",
"store": true,
"index_lexical": false
},
{
"field": "image",
"field_type": "Binary",
"store": true,
"index_lexical": false
},
{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "url",
"field_type": "Text",
"store": true,
"index_lexical": false
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": true,
"longest": true
},
{
"field": "about",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "manufacturer",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "brand",
"field_type": "Text",
"store": true,
"index_lexical": true
},
{
"field": "category",
"field_type": "Text",
"store": true,
"index_lexical": true
}
],
"index_name": "amazon_index",
"similarity": "Bm25fProximity",
"tokenizer": "UnicodeAlphanumeric"
}
// realtime vector search
### create index
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": false,
"index_vector": true
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": false,
"index_vector": true
},
{
"field": "url",
"field_type": "String32",
"store": true,
"index_lexical": false,
"index_vector": false
}],
"index_name": "test_index",
"clustering": "None",
"inference": {"Model2Vec": { "model": "PotionBase2M", "chunk_size": 1000, "quantization": "I8" }}
}
### index document
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[
{"title":"pink panther","body":"animal from a comedy","url":"url1"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"red fox","body":"small carnivorous mammal","url":"url3"}
]
### query index POST
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"rosy panther",
"offset":0,
"length":10,
"result_type": "TopkCount",
"realtime": true,
"search_mode": {"Vector":{"similarity_threshold": 0.7, "ann_mode": "Auto"}}
}
// commit incomplete levels
### create index
POST http://127.0.0.1:80/api/v1/index HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"schema":[{
"field": "title",
"field_type": "Text",
"store": true,
"index_lexical": false,
"index_vector": true
},
{
"field": "body",
"field_type": "Text",
"store": true,
"index_lexical": false,
"index_vector": true
},
{
"field": "url",
"field_type": "String32",
"store": true,
"index_lexical": false,
"index_vector": false
}],
"index_name": "test_index",
"clustering": "None",
"inference": {"Model2Vec": { "model": "PotionBase2M", "chunk_size": 1000, "quantization": "I8" }}
}
### index document
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[
{"title":"pink panther","body":"animal from a comedy","url":"url1"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"red fox","body":"small carnivorous mammal","url":"url3"}
]
### commit index
PATCH http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### index document
POST http://127.0.0.1:80/api/v1/index/0/doc HTTP/1.1
apikey: {{api_key}}
content-type: application/json
[
{"title":"pink panther","body":"animal from a comedy","url":"url1"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"blue whale","body":"largest mammal in the ocean","url":"url2"},
{"title":"red fox","body":"small carnivorous mammal","url":"url3"}
]
### commit index
PATCH http://127.0.0.1/api/v1/index/0 HTTP/1.1
apikey: {{api_key}}
content-type: application/json
### query index POST
POST http://127.0.0.1/api/v1/index/0/query HTTP/1.1
apikey: {{api_key}}
content-type: application/json
{
"query":"rosy panther",
"offset":0,
"length":10,
"result_type": "TopkCount",
"realtime": false,
"search_mode": {"Vector":{"similarity_threshold": 0.7, "ann_mode": "Auto"}}
}