Manticoresearch.IndexApi

October 22, 2025 ยท View on GitHub

All URIs are relative to http://127.0.0.1:9308

MethodHTTP requestDescription
bulkPOST /json/bulkBulk index operations
callDeletePOST /json/deleteDelete a document in an index
insertPOST /json/insertCreate a new document in an index
replacePOST /json/replaceReplace new document in an index
updatePOST /json/updateUpdate a document in an index

bulk

BulkResponse bulk(body)

Bulk index operations

Sends multiple operatons like inserts, updates, replaces or deletes. For each operation it's object must have same format as in their dedicated method. The method expects a raw string as the batch in NDJSON. Each operation object needs to be serialized to JSON and separated by endline (\n).

An example of raw input:

  {"insert": {"table" : "products", "id" : 3, "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}}}\n
  {"insert": {"table" : "products", "id" : 4, "doc" : {"title" : "microfiber sheet set", "price" : 19.99}}}\n
  {"insert": {"table" : "products", "id" : 5, "doc" : {"title" : "CPet Hair Remover Glove", "price" : 7.99}}}

Responds with an object telling whenever any errors occured and an array with status for each operation:

{'items':[{'update':{'table':'products','_id':1,'result':'updated'}},{'update':{'table':'products','_id':2,'result':'updated'}}],'errors':false}

Example

var Manticoresearch = require('manticoresearch');

var indexApi = new Manticoresearch.IndexApi();
async function(){
    let docs = [ 
            {"insert": {"table" : "products", "id" : 3, "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}}}, 
            {"insert": {"table" : "products", "id" : 4, "doc" : {"title" : "microfiber sheet set", "price" : 19.99}}}, 
            {"insert": {"table" : "products", "id" : 5, "doc" : {"title" : "CPet Hair Remover Glove", "price" : 7.99}}}
    ];
    res =  await indexApi.bulk(docs.map(e=>JSON.stringify(e)).join('\n'));
    console.log(JSON.stringify(res));
}

Parameters

NameTypeDescriptionNotes
bodyString

Return type

BulkResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-ndjson
  • Accept: application/json

callDelete

DeleteResponse callDelete(deleteDocumentRequest)

Delete a document in a table

Delete one or several documents. The method has 2 ways of deleting: either by id, in case only one document is deleted or by using a match query, in which case multiple documents can be delete . Example of input to delete by id:

{"table" : "products", "id" : 1}

Example of input to delete using a query:

{"table" : "products", "query": { "match": { "*": "superseeded" }}}

The match query has same syntax as in for searching. Responds with an object telling how many documents got deleted:

{'table':'products','updated':1}

Example

var Manticoresearch = require('manticoresearch');

var indexApi = new Manticoresearch.IndexApi();
async function() {
    res =  await indexApi.callDelete({"table" : "products", "id" : 1});
    console.log(JSON.stringify(res));
}

Parameters

NameTypeDescriptionNotes
deleteDocumentRequestDeleteDocumentRequest

Return type

DeleteResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

insert

SuccessResponse insert(insertDocumentRequest)

Create a new document in a table

Insert a document. Expects an object like:

{"table" : "products", "id" : 1, "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}}

The document id can also be missing, in which case an autogenerated one will be used:

{"table" : "products", "id" : 0, "doc" : {"title" : "Yellow bag"}}

It responds with an object in format:

{'table':'products','_id':1,'created':true,'result':'created','status':201}

Example

var Manticoresearch = require('manticoresearch');

var indexApi = new Manticoresearch.IndexApi();
async function(){
    res =  await indexApi.insert({"table" : "products", "id" : 1, "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}});
}

Parameters

NameTypeDescriptionNotes
insertDocumentRequestInsertDocumentRequest

Return type

SuccessResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

replace

SuccessResponse replace(insertDocumentRequest)

Replace new document in a table

Replace an existing document. Input has same format as insert operation.
Responds with an object in format:

{'table':'products','_id':1,'created':false,'result':'updated','status':200}

Example

var Manticoresearch = require('manticoresearch');

var indexApi = new Manticoresearch.IndexApi();
async function(){
    res =  await indexApi.replace({"table" : "products", "id" : 1, "doc" : {"title" : "document one","price":10}});
}    

Parameters

NameTypeDescriptionNotes
insertDocumentRequestInsertDocumentRequest

Return type

SuccessResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update

UpdateResponse update(updateDocumentRequest)

Update a document in a table

Update one or several documents. The update can be made by passing the id or by using a match query in case multiple documents can be updated. For example update a document using document id:

{"table" : "products", "id" : 1, "doc" : {"price":10}}

And update by using a match query:

{'table':'products','doc':"price":10},'query':{'bool':{'must':[{'query_string':'yellow bag'}]}}}

The match query has same syntax as for searching. Responds with an object that tells how many documents where updated in format:

{'table':'products','updated':1}

Example

var Manticoresearch = require('manticoresearch');

var indexApi = new Manticoresearch.IndexApi();
async function() {
    res =  await indexApi.update({"table" : "products", "id" : 1, "doc" : {"price":10}});
}

Parameters

NameTypeDescriptionNotes
updateDocumentRequestUpdateDocumentRequest

Return type

UpdateResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json