Socket
Socket
Sign inDemoInstall

elastic-dsl-typescript

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.1.0

8

Builders/Aggregation/index.js

@@ -27,5 +27,5 @@ "use strict";

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

@@ -35,3 +35,3 @@ return this;

this._data[name] = {
[aggType]: Object.assign(Object.assign({}, d.params), (d.opts || {}))
[aggType]: Object.assign(Object.assign({}, d.params), (d.opts || {})),
};

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

@@ -34,2 +34,3 @@ import { AggSchema } from '../../Abstract/Schema';

field: string;
filter?: FilterAggregation;
ranges: RangeAggregation;

@@ -41,2 +42,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -48,2 +50,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -55,2 +58,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -62,2 +66,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -69,2 +74,3 @@ };

field: string;
filter?: FilterAggregation;
percents?: [number, number, number];

@@ -76,2 +82,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -78,0 +85,0 @@ };

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

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

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

@@ -11,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',
},
},
});

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

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

@@ -37,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',
},
},
});

@@ -60,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',
},
},
},
});

@@ -83,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,
},
});

@@ -97,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,
},
},
});

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

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

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

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

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

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

@@ -163,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,
},
});

@@ -181,7 +182,55 @@ // 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', {
params: {
field: 'price',
filter: new Bool()
.Must('exists', {
params: {
fieldName: 'testfield',
},
})
.build(),
ranges: [
{
from: 1,
},
],
},
});
expect(a.build()).toEqual({
my_range: {
aggs: {
my_range_filtered: {
range: {
field: 'price',
ranges: [
{
from: 1,
},
],
},
},
},
filter: {
bool: {
must: [
{
exists: {
field: 'testfield',
},
},
],
},
},
},
});
});
});

@@ -14,5 +14,5 @@ import { AbstractBulder } from '../../Abstract/AbstractBuilder';

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

@@ -23,3 +23,3 @@ return this;

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

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

import { AggSchema } from '../../Abstract/Schema';
import { RangeAggregation, PainLessScript } from '../../Types';
import { RangeAggregation, PainLessScript } from '../../Types';

@@ -35,3 +35,3 @@ export interface AggregationSchema extends AggSchema {

field: string;
filter?: FilterAggregation;
ranges: RangeAggregation;

@@ -44,3 +44,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -52,3 +52,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -60,3 +60,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -68,3 +68,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -76,3 +76,3 @@ };

field: string;
filter?: FilterAggregation;
percents?: [number, number, number];

@@ -84,3 +84,3 @@ };

field: string;
filter?: FilterAggregation;
script?: PainLessScript;

@@ -87,0 +87,0 @@ };

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