Home

Awesome

Manticore Javascript client

Сlient for Manticore Search.

❗ WARNING: this is a development version of the client. The latest release's readme is https://github.com/manticoresoftware/manticoresearch-javascript/tree/4.0.0

Requirements

Minimum Manticore Search version is 2.5.1 with HTTP protocol enabled.

Manticore Searchmanticoresearch-javascriptNode
devmanticoresearch-dev>= 10.0
>= 6.2.0>= 3.3.1>= 10.0
>= 4.2.1>= 3.0.x>= 10.0
>= 4.0.2>= 2.0.3>= 10.0
>= 2.5.1>= 2.0.2>= 8.0

Installation

npm install manticoresearch-dev 

Getting Started

Please follow the installation instruction and execute the following Javascript code:

var Manticoresearch = require('manticoresearch');
var client = new Manticoresearch.ApiClient();
client.basePath="http://localhost:9308";
/*
If a custom http agent is needed, e.g., to enable keep-alive connections, the 'requestAgent' option can be set to override 'superagent' agent instance used by default:
client.requestAgent = new http.Agent({
  keepAlive: true,
  maxSockets: 1,
  keepAliveMsecs: 1000
});
*/

var api = new Manticoresearch.IndexApi(client)
var body = ["'{\"insert\": {\"index\": \"test\", \"id\": 1, \"doc\": {\"title\": \"Title 1\"}}},\\n{\"insert\": {\"index\": \"test\", \"id\": 2, \"doc\": {\"title\": \"Title 2\"}}}'"]; // {String} 
api.bulk(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

var searchApi = new Manticoresearch.SearchApi(client);

// Create SearchRequest
var searchRequest = new Manticoresearch.SearchRequest();
searchRequest.index = "test";
searchRequest.fulltext_filter = new Manticoresearch.QueryFilter('Star Trek 2');

// Perform a search
async function(){
    var res = await searchApi.search(searchRequest);
    console.log(JSON.stringify(res, null, 4));
}


Documentation

Full documentation on the API Endpoints and Models used is available in docs folder as listed below.

Manticore Search server documentation: https://manual.manticoresearch.com.

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
Manticoresearch.IndexApibulkPOST /bulkBulk index operations
Manticoresearch.IndexApicallDeletePOST /deleteDelete a document in an index
Manticoresearch.IndexApiinsertPOST /insertCreate a new document in an index
Manticoresearch.IndexApireplacePOST /replaceReplace new document in an index
Manticoresearch.IndexApiupdatePOST /updateUpdate a document in an index
Manticoresearch.IndexApiupdate_0POST /{index}/_update/{id}Partially replaces a document in an index
Manticoresearch.SearchApipercolatePOST /pq/{index}/searchPerform reverse search on a percolate index
Manticoresearch.SearchApisearchPOST /searchPerforms a search on an index
Manticoresearch.UtilsApisqlPOST /sqlPerform SQL requests

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.