Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
node-oss-client
Advanced tools
A Node.js client for Open Search Server.
See also parent module oss-odm.
npm install node-oss-client
var oss = require('node-oss-client'),
client = oss.createClient();
client.search('my_index', {
query: 'my query'
}, function (err, res) {
// ...
});
See the examples
directory in this repo for more examples.
Create a new client. Available options are
var client = oss.createClient({
hostname: 'my.host.com',
port: 8080,
protocol: 'http'
});
Search in a custom index, you can specify search type with options.type
(field or pattern). Others options are avalaible in OSS Documentation.
client.search('my_index', {
query: 'my_query'
}, function (err, res) { });
Request a more like this query on a custom index. Available options can be found in OSS Documentation.
client.moreLikeThis('my_index', {
likeText: 'Text to search for similarity'
}, function (err, res) { });
Request autocompletion on an auto-completion item of a custom index. Available options can be found in OSS Documentation.
client.autocompletion('my_index', 'autocomplete_item', {
prefix: 'Text to complete'
}, function (err, res) { });
Create a new index, you can specify a template with options.template
.
client.indexes.create('my_index', [options], function (err, res) { });
Test if an index exists.
client.indexes.exists('my_index', function (err, res) { });
Destroy an existing index.
client.indexes.destroy('my_index', function (err, res) { });
Create or update a new field on an existing index. Options are avalaible in OSS Documentation.
Aliases: client.fields.update, client.fields.create.
client.fields.create('my_index', {
name: 'my_field'
}, function (err, res) { });
List all index fields.
client.fields.list('my_index', function (err, res) { });
Destroy an existing field on an existing index.
client.fields.destroy('my_index', 'my_field', function (err, res) { });
Specify a default and unique index.
client.fields.setUniqueDefault('my_index', { unique: 'my_unique_field', default: 'my_default_field' }, function (err, res) { });
Create or update a search template. Options are avalaible in OSS Documentation.
Aliases: client.templates.update, client.templates.create.
client.templates.create('my_index', 'my_template', { returnedFields: ['my_field'] }, function (err, res) { });
List all search templates associated to the specified index.
client.templates.list('my_index', function (err, res) { });
Get a search template.
client.templates.get('my_index', 'my_template', function (err, res) { });
Destroy a search template.
client.templates.destroy('my_index', 'my_template', function (err, res) { });
Create or update documents on an existing index. Options are avalaible in OSS Documentation.
Aliases: client.documents.update, client.documents.create.
client.documents.create('my_index', [
{
lang: 'FRENCH',
fields: [
{name: 'id', value: 1},
{name: 'content', value: 'Hello world!'}
]
},
{
lang: 'FRENCH',
fields: [
{name: 'id', value: 2},
{name: 'content', value: 'Hello world 2!'}
]
}
], function (err, res) { });
Destroy existing documents on an existing index. You must specify a field (options.field
) and some values (options.values
).
client.documents.destroy('my_index', {
field: 'id',
values: [1, 2]
}, function (err, res) { });
Creates an index of replication on an OSS server. You must specify an object searcher
with 3 keys : hostname
, port
and an optional protocol
(http by default).
client.replication.createIndexReplication('my_index', {
hostname: 'searcher-oss.com',
port: 8080,
protocol: 'http'
}, function (err, res) { });
Starts a replication of the index passed as argument on an other OSS server passed as argument. You must specify an object searcher
with 3 keys : hostname
, port
and an optional protocol
(http by default).
client.replication.replicate('my_index', {
hostname: 'searcher-oss.com',
port: 8080,
protocol: 'http'
}, function (err, res) { });
MIT
FAQs
Node.js client for Open Search Server.
The npm package node-oss-client receives a total of 24 weekly downloads. As such, node-oss-client popularity was classified as not popular.
We found that node-oss-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.