New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

etk

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

etk

Elastic search tool kit.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

ElasticSearch Tool Kit

Makes life easy with ElasticSearch.

Linux Build Dependency Status devDependency Status

elastic = require('elasticsearch');
Etk = require('etk');

// Elasticsearch instance is initialized as documented at it's
// project space
var client = elastic.Client({hosts: ['localhost:9200']});

// Etk instance "tk_1" calls against index = my_index and type = my_type
var tk_1 = Etk(client, {index: "my_index", type: "my_type"});

// search Etk API call returns back the search result
tk_1.search("foo", "bar", function (err, resp) {

    // Etk inserts "source()" method to response, so you can easily get 
    // the data array found in search
    console.log(JSON.stringify(resp.source());
    
    // Etk inserts "score()" method to response, so you can easily get 
    // the score array found in search
    console.log(JSON.stringify(resp.score());
            
    // elasticsearch original response can be reached from resp.resp 
    // for further data manipulation for special cases.
    console.log(JSON.stringify(resp.resp);
});

// Etk instance "tk_2" forwards elasticsearch error and response messages
// to application. See class documentation for full list of options
// you can configure
var tk_2 = Etk(client, {index: "another_index",
                        type: "another_type",
                        raw_response: true,
                        raw_error: true});

// search Etk API call returns back the search result
tk_2.search("baz", "bar", function (err, resp) {

        // Application should handle raw error and response messages
        // received from elasticsearch.
        ...
});

Installation

$ npm install etk

Features

  • Provides high level, easy to use interface for Elastic Search in your Node.js project.
  • Etk extents the official elasticsearch project with well documented function calls.
  • Parses elasticsearch error and response messages in useful ways. Yet you have the option to receive them as they are with configuration options.
  • Uses same elasticsearch instance in multiple Etk clients.
  • All API calls are tested against the latest elasticsearch release.
  • Elasticsearch can be used alongside with Etk without any code change.

API Documentation with Examples

Project site documents the latest NPM release.

TODO

  • Currently project covers a very small subset of possible function calls. Please extend the library and open a pull request for merge.
  • Promise support is missing. Only callback mechanism is implemented.
  • Browser support is not available yet.

People

Original author of Etk is R. Saltuk Alakus

Looking for maintainers. Please drop me an email at saltukalakus@gmail.com

License

MIT

Keywords

FAQs

Package last updated on 15 Oct 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc