Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elastic-dsl-typescript

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elastic-dsl-typescript

Node.js ElasticSearch search query builder

  • 1.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by22.22%
Maintainers
1
Weekly downloads
 
Created
Source

Typescript implementation of the ElasticSearch query DSL

Support :
  • nested
  • script_fields
  • bool
  • query
  • aggregations (in progress...)

Generating hints based on types : type Based on the selected, the context of the prompts changes : bool_type After selecting the filter type, it shows options for a specific range_opts


range_params


Not all fields are currently implemented. But you can extend the support yourself in your code.*** range_params

Advanced exapmles in tests directory

example:
import { Bool, Query } from '../../index';

const q = new Query()
  .addProps('_source', ['field'])
  .addProps('explain', true)
  .addProps('from', 0)
  .addProps('size', 100)
  .addProps('q', 'Lucene query string ')
  .addQuery('match', {
    message: {
      query: 'query',
    },
  })
  .addQuery('term', {
    field: 'f',
    value: 'term',
  })
  .addQuery('range', {
    gt: 0,
    gte: 0,
  });

q.bool.addBuilder(
  'must',
  new Bool().add('must', 'term', {
    field: 'articul',
    params: {
      value: '111',
    },
  }),
);
result :
{
  "_source": ["field"],
  "explain": true,
  "from": 0,
  "q": "Lucene query string ",
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "must": [
              {
                "term": {
                  "articul": {
                    "value": "111"
                  }
                }
              }
            ]
          }
        }
      ]
    },
    "match": {
      "message": {
        "query": "query"
      }
    },
    "range": {
      "gt": 0,
      "gte": 0
    },
    "term": {
      "field": "f",
      "value": "term"
    }
  },
  "size": 100
}
TEST
npm run test

Keywords

FAQs

Package last updated on 24 Aug 2021

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