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 - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

6

Builders/Aggregation/index.js

@@ -25,3 +25,3 @@ "use strict";

sub = {
aggs: Object.assign({}, subAgg),
aggs: Object.assign({}, subAgg)
};

@@ -33,4 +33,4 @@ }

aggs: {
[`${name}_filtered`]: Object.assign({ [aggType]: Object.assign(Object.assign({}, all), (d.opts || {})) }, sub),
},
[`${name}_filtered`]: Object.assign({ [aggType]: Object.assign(Object.assign({}, all), (d.opts || {})) }, sub)
}
};

@@ -37,0 +37,0 @@ return this;

@@ -91,2 +91,21 @@ import { AggSchema } from "../../Abstract/Schema";

};
histogram: {
params: {
field: string;
min_doc_count?: number;
/**
* The interval must be a positive decimal.
*/
interval: number;
/**
* With extended_bounds setting, you now can "force" the histogram aggregation to start building buckets on a specific min value and also keep on building buckets up to a max value .
* Using extended_bounds only makes sense when min_doc_count is 0 (the empty buckets will never be returned if min_doc_count is greater than 0).
*/
extended_bounds?: {
min: number;
max: number;
};
missing?: number | any;
};
};
}

@@ -93,0 +112,0 @@ export interface FilterAggregation {

{
"name": "elastic-dsl-typescript",
"version": "1.1.1",
"version": "1.1.2",
"description": "Node.js ElasticSearch search query builder",

@@ -5,0 +5,0 @@ "main": "./",

@@ -19,3 +19,3 @@ import { AbstractBulder } from '../Abstract/AbstractBuilder';

*/
addProps<K extends keyof Omit<RawQuery, 'query'>>(prop: K, data: RawQuery[K]): this;
addProps<K extends keyof Omit<RawQuery, "query">>(prop: K, data: RawQuery[K]): this;
/**

@@ -22,0 +22,0 @@ * Create query (match,bool, etc...)

@@ -1,3 +0,3 @@

import { Aggregation } from '../../Builders/Aggregation';
import { Bool } from '../../Builders/Bool';
import { Aggregation } from "../../Builders/Aggregation";
import { Bool } from "../../Builders/Bool";

@@ -12,8 +12,8 @@ describe('Check aggs builder', () => {

params: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_avg.value * 2',
},
},
source: "doc.my_avg.value * 2"
}
}
});

@@ -24,9 +24,9 @@

avg: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_avg.value * 2',
},
},
},
source: "doc.my_avg.value * 2"
}
}
}
});

@@ -38,19 +38,19 @@ });

params: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_max.value * 2',
},
},
source: "doc.my_max.value * 2"
}
}
})
.add('min', 'my_min', {
params: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_min.value * 2',
},
},
source: "doc.my_min.value * 2"
}
}
});

@@ -61,18 +61,18 @@

max: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_max.value * 2',
},
},
source: "doc.my_max.value * 2"
}
}
},
my_min: {
min: {
field: 'price',
field: "price",
script: {
params: {},
source: 'doc.my_min.value * 2',
},
},
},
source: "doc.my_min.value * 2"
}
}
}
});

@@ -84,10 +84,10 @@ });

params: {
field: 'color',
field: "color"
},
opts: {
exclude: ['red'],
include: ['black', 'green'],
exclude: ["red"],
include: ["black", "green"],
min_doc_count: 2,
size: 100,
},
size: 100
}
});

@@ -98,9 +98,9 @@

terms: {
exclude: ['red'],
field: 'color',
include: ['black', 'green'],
exclude: ["red"],
field: "color",
include: ["black", "green"],
min_doc_count: 2,
size: 100,
},
},
size: 100
}
}
});

@@ -112,12 +112,12 @@ });

params: {
field: 'price',
field: "price",
ranges: [
{
from: 100,
from: 100
},
{
to: 1000,
},
],
},
to: 1000
}
]
}
});

@@ -128,13 +128,13 @@

range: {
field: 'price',
field: "price",
ranges: [
{
from: 100,
from: 100
},
{
to: 1000,
},
],
},
},
to: 1000
}
]
}
}
});

@@ -148,12 +148,12 @@ });

params: {
field: 'price',
field: "price",
ranges: [
{
from: 100,
from: 100
},
{
to: 1000,
},
],
},
to: 1000
}
]
}
});

@@ -164,11 +164,11 @@

test('Create filtered terms agg', async () => {
const a = new Aggregation().add('terms', 'availStoreSizes', {
test("Create filtered terms agg", async () => {
const a = new Aggregation().add("terms", "availStoreSizes", {
params: {
field: 'availSizes.sizes.keyword',
filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } },
field: "availSizes.sizes.keyword",
filter: { terms: { "availSizes.IStoreId.keyword": ["0000"] } }
},
opts: {
size: 50,
},
size: 50
}
});

@@ -182,17 +182,17 @@ // availStoreSizes: {

availStoreSizes: {
aggs: { availStoreSizes_filtered: { terms: { field: 'availSizes.sizes.keyword', size: 50 } } },
filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } },
},
aggs: { availStoreSizes_filtered: { terms: { field: "availSizes.sizes.keyword", size: 50 } } },
filter: { terms: { "availSizes.IStoreId.keyword": ["0000"] } }
}
});
});
test('Create range with sub aggs', async () => {
const a = new Aggregation().add('range', 'my_range', {
test("Create range with sub aggs", async () => {
const a = new Aggregation().add("range", "my_range", {
params: {
field: 'price',
field: "price",
filter: new Bool()
.Must('exists', {
.Must("exists", {
params: {
fieldName: 'testfield',
},
fieldName: "testfield"
}
})

@@ -202,6 +202,6 @@ .build(),

{
from: 1,
},
],
},
from: 1
}
]
}
});

@@ -214,10 +214,10 @@

range: {
field: 'price',
field: "price",
ranges: [
{
from: 1,
},
],
},
},
from: 1
}
]
}
}
},

@@ -229,25 +229,25 @@ filter: {

exists: {
field: 'testfield',
},
},
],
},
},
},
field: "testfield"
}
}
]
}
}
}
});
});
test('Create term sub aggs', async () => {
const a = new Aggregation().add('terms', 'testField', {
test("Create term sub aggs", async () => {
const a = new Aggregation().add("terms", "testField", {
params: {
field: 'testField',
field: "testField",
subAgg: {
stores: {
terms: {
field: 'availStores',
field: "availStores",
size: 5,
include: ['124214'],
},
},
},
},
include: ["124214"]
}
}
}
}
});

@@ -260,14 +260,14 @@

terms: {
field: 'availStores',
include: ['124214'],
size: 5,
},
},
field: "availStores",
include: ["124214"],
size: 5
}
}
},
terms: {
field: 'testField',
},
},
field: "testField"
}
}
});
});
});

@@ -26,11 +26,11 @@ import { Aggregation, Bool, BoolSchema, 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', {
.addProps("_source", ["field"])
.addProps("explain", true)
.addProps("from", 0)
.addProps("size", 100)
.addProps("q", "Lucene query string ")
.addQuery("match", {
message: {
query: "query"
},
}
})

@@ -93,3 +93,3 @@ .addQuery("term", {

articul: "111"
},
}
},

@@ -96,0 +96,0 @@ ],

@@ -13,4 +13,4 @@ import { AbstractBulder } from '../../Abstract/AbstractBuilder';

aggs: {
...subAgg,
},
...subAgg
}
};

@@ -23,6 +23,6 @@ }

[`${name}_filtered`]: {
[aggType]: { ...all, ...((d.opts as object) || {}) },
...sub,
},
},
[aggType]: { ...all, ...((d.opts as object) || {}) },
...sub
}
}
};

@@ -33,4 +33,4 @@ return this;

this._data[name] = {
[aggType]: { ...all, ...((d.opts as object) || {}) },
...sub,
[aggType]: { ...all, ...((d.opts as object) || {}) },
...sub
};

@@ -37,0 +37,0 @@ return this;

import { AggSchema } from "../../Abstract/Schema";
import { RangeAggregation, PainLessScript } from "../../Types";
export interface SubAggregation {

@@ -97,2 +96,21 @@ subAgg?: FilterAggregation;

};
histogram: {
params: {
field: string;
min_doc_count?: number;
/**
* The interval must be a positive decimal.
*/
interval: number;
/**
* With extended_bounds setting, you now can "force" the histogram aggregation to start building buckets on a specific min value and also keep on building buckets up to a max value .
* Using extended_bounds only makes sense when min_doc_count is 0 (the empty buckets will never be returned if min_doc_count is greater than 0).
*/
extended_bounds?: {
min: number;
max: number;
};
missing?: number | any;
};
};
}

@@ -99,0 +117,0 @@

@@ -11,3 +11,3 @@ import { AbstractBulder } from '../Abstract/AbstractBuilder';

export class Query<BOOL_SCHEMA extends BoolSchema> extends AbstractBulder {
private _props: Omit<RawQuery, 'query'> = {};
private _props: Omit<RawQuery, "query"> = {};
private _query: RawQuery["query"] = {};

@@ -22,3 +22,3 @@ private _post_filter: Bool = new Bool<BoolSchema>();

*/
public addProps<K extends keyof Omit<RawQuery, 'query'>>(prop: K, data: RawQuery[K]) {
public addProps<K extends keyof Omit<RawQuery, "query">>(prop: K, data: RawQuery[K]) {
this._props[prop] = data;

@@ -25,0 +25,0 @@ return this;

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