Socket
Socket
Sign inDemoInstall

elasticsearch-sanitize

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    elasticsearch-sanitize

Elastic Search String Sanitizer for Node


Version published
Weekly downloads
4.2K
increased by27.88%
Maintainers
1
Install size
5.98 kB
Created
Weekly downloads
 

Readme

Source

node-elasticsearch-sanitize

Circle CI

npm install --save elasticsearch-sanitize

Accepts an arbitrary string as input and escapes the ElasticSearch reserved characters:

+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / AND OR NOT space

Returns a sanitized string which can be safely used in an ElasticSearch query_string query.

Usage

To use pass in a string:

var myString = "AND there! are? (lots of) char*cters 2 ^escape!"
console.log(escapeElastic(myString))

And it will return:

\A\N\D\ there\!\ are\?\ \(lots\ of\)\ char\*cters\ 2\ \^escape\!

Keywords

FAQs

Last updated on 17 Nov 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc