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.2.1 to 1.2.3

.gitattributes

6

package.json
{
"name": "elastic-dsl-typescript",
"version": "1.2.1",
"version": "1.2.3",
"description": "Node.js ElasticSearch search query builder",
"main": "./",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepublish": " npm run build && npm version patch -m \"Upgrade to %s \"",
"test": "./node_modules/.bin/jest -i --coverage --forceExit",

@@ -8,0 +10,0 @@ "copyData": "cp package.json ./dist/package.json && cp ./README.md ./dist/README.md && cp ./LICENSE ./dist/LICENSE && cp -r ./img ./dist/img && cp -r ./src ./dist/ ",

@@ -1,2 +0,2 @@

### Typescript implementation of the ElasticSearch query DSL
### Library for generating queries (Elastic DSL) in the typescript language.

@@ -3,0 +3,0 @@ ##### Support :

@@ -5,284 +5,284 @@ import { Aggregation } from '../../Builders/Aggregation';

describe('Check aggs builder', () => {
beforeEach(() => {
jest.clearAllMocks();
});
test('Create avg', async () => {
const a = new Aggregation().add('avg', 'my_avg', {
params: {
field: 'price',
script: {
params: {},
source: 'doc.my_avg.value * 2'
}
}
beforeEach(() => {
jest.clearAllMocks();
});
expect(a.build()).toEqual({
my_avg: {
avg: {
field: 'price',
script: {
params: {},
source: 'doc.my_avg.value * 2'
}
}
}
});
});
test('Create max min', async () => {
const a = new Aggregation()
.add('max', 'my_max', {
params: {
field: 'price',
test('Create avg', async () => {
const a = new Aggregation().add('avg', 'my_avg', {
params: {
field: 'price',
script: {
params: {},
source: 'doc.my_avg.value * 2'
}
}
});
script: {
params: {},
source: 'doc.my_max.value * 2'
}
}
})
.add('min', 'my_min', {
params: {
field: 'price',
script: {
params: {},
source: 'doc.my_min.value * 2'
}
}
});
expect(a.build()).toEqual({
my_max: {
max: {
field: 'price',
script: {
params: {},
source: 'doc.my_max.value * 2'
}
}
},
my_min: {
min: {
field: 'price',
script: {
params: {},
source: 'doc.my_min.value * 2'
}
}
}
expect(a.build()).toEqual({
my_avg: {
avg: {
field: 'price',
script: {
params: {},
source: 'doc.my_avg.value * 2'
}
}
}
});
});
});
test('Create max min', async () => {
const a = new Aggregation()
.add('max', 'my_max', {
params: {
field: 'price',
test('Create terms', async () => {
const a = new Aggregation().add('terms', 'my_terms', {
params: {
field: 'color'
},
opts: {
exclude: ['red'],
include: ['black', 'green'],
min_doc_count: 2,
size: 100
}
});
script: {
params: {},
source: 'doc.my_max.value * 2'
}
}
})
.add('min', 'my_min', {
params: {
field: 'price',
expect(a.build()).toEqual({
my_terms: {
terms: {
exclude: ['red'],
field: 'color',
include: ['black', 'green'],
min_doc_count: 2,
size: 100
}
}
});
});
script: {
params: {},
source: 'doc.my_min.value * 2'
}
}
});
test('Create range', async () => {
const a = new Aggregation().add('range', 'my_range', {
params: {
field: 'price',
ranges: [
{
from: 100
},
{
to: 1000
}
]
}
expect(a.build()).toEqual({
my_max: {
max: {
field: 'price',
script: {
params: {},
source: 'doc.my_max.value * 2'
}
}
},
my_min: {
min: {
field: 'price',
script: {
params: {},
source: 'doc.my_min.value * 2'
}
}
}
});
});
expect(a.build()).toEqual({
my_range: {
range: {
field: 'price',
ranges: [
{
from: 100
test('Create terms', async () => {
const a = new Aggregation().add('terms', 'my_terms', {
params: {
field: 'color'
},
{
to: 1000
opts: {
exclude: ['red'],
include: ['black', 'green'],
min_doc_count: 2,
size: 100
}
]
}
}
});
});
test('Check isNotEmty func', async () => {
const a = new Aggregation();
expect(a.isNotEmty()).toBeFalsy();
});
a.add('range', 'my_range', {
params: {
field: 'price',
ranges: [
{
from: 100
},
{
to: 1000
}
]
}
expect(a.build()).toEqual({
my_terms: {
terms: {
exclude: ['red'],
field: 'color',
include: ['black', 'green'],
min_doc_count: 2,
size: 100
}
}
});
});
expect(a.isNotEmty()).toBeTruthy();
});
test('Create range', async () => {
const a = new Aggregation().add('range', 'my_range', {
params: {
field: 'price',
ranges: [
{
from: 100
},
{
to: 1000
}
]
}
});
test('Create filtered terms agg', async () => {
const a = new Aggregation().add('terms', 'availStoreSizes', {
params: {
field: 'availSizes.sizes.keyword',
filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } }
},
opts: {
size: 50
}
expect(a.build()).toEqual({
my_range: {
range: {
field: 'price',
ranges: [
{
from: 100
},
{
to: 1000
}
]
}
}
});
});
// availStoreSizes: {
// aggs: { sizes: { terms: { field: 'availSizes.sizes.keyword', size: 50 } } },
// filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } },
// },
test('Check isNotEmty func', async () => {
const a = new Aggregation();
expect(a.isNotEmty()).toBeFalsy();
expect(a.build()).toEqual({
availStoreSizes: {
aggs: { availStoreSizes_filtered: { terms: { field: 'availSizes.sizes.keyword', size: 50 } } },
filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } }
}
a.add('range', 'my_range', {
params: {
field: 'price',
ranges: [
{
from: 100
},
{
to: 1000
}
]
}
});
expect(a.isNotEmty()).toBeTruthy();
});
});
test('Create range with sub aggs', async () => {
const a = new Aggregation().add('range', 'my_range', {
params: {
field: 'price',
filter: new Bool()
.Must('exists', {
test('Create filtered terms agg', async () => {
const a = new Aggregation().add('terms', 'availStoreSizes', {
params: {
fieldName: 'testfield'
field: 'availSizes.sizes.keyword',
filter: {terms: {'availSizes.IStoreId.keyword': ['0000']}}
},
opts: {
size: 50
}
})
.build(),
ranges: [
{
from: 1
}
]
}
});
// availStoreSizes: {
// aggs: { sizes: { terms: { field: 'availSizes.sizes.keyword', size: 50 } } },
// filter: { terms: { 'availSizes.IStoreId.keyword': ['0000'] } },
// },
expect(a.build()).toEqual({
availStoreSizes: {
aggs: {availStoreSizes_filtered: {terms: {field: 'availSizes.sizes.keyword', size: 50}}},
filter: {terms: {'availSizes.IStoreId.keyword': ['0000']}}
}
});
});
expect(a.build()).toEqual({
my_range: {
aggs: {
my_range_filtered: {
range: {
field: 'price',
ranges: [
{
from: 1
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'
}
}
]
}
}
]
},
});
});
test('Create term sub aggs', async () => {
const a = new Aggregation().add('terms', 'testField', {
params: {
field: 'testField',
subAgg: {
stores: {
terms: {
field: 'availStores',
size: 5,
include: ['124214']
}
}
}
}
}
},
filter: {
bool: {
must: [
{
exists: {
field: 'testfield'
});
expect(a.build()).toEqual({
testField: {
aggs: {
stores: {
terms: {
field: 'availStores',
include: ['124214'],
size: 5
}
}
},
terms: {
field: 'testField'
}
}
]
}
}
},
},
});
});
});
test('Create term sub aggs', async () => {
const a = new Aggregation().add('terms', 'testField', {
params: {
field: 'testField',
subAgg: {
stores: {
terms: {
field: 'availStores',
size: 5,
include: ['124214']
test('Create histogramm', async () => {
const a = new Aggregation().add('histogram', 'testField', {
params: {
field: 'testField',
interval: 10,
extended_bounds: {
max: 100,
min: 0
},
min_doc_count: 0,
missing: 0
}
}
}
}
});
});
expect(a.build()).toEqual({
testField: {
aggs: {
stores: {
terms: {
field: 'availStores',
include: ['124214'],
size: 5
expect(a.build()).toEqual({
testField: {
histogram: {
extended_bounds: {
max: 100,
min: 0
},
field: 'testField',
interval: 10,
min_doc_count: 0,
missing: 0
}
}
}
},
terms: {
field: 'testField'
}
},
});
});
});
test('Create histogramm', async () => {
const a = new Aggregation().add('histogram', 'testField', {
params: {
field: 'testField',
interval: 10,
extended_bounds: {
max: 100,
min: 0
},
min_doc_count: 0,
missing: 0
}
});
expect(a.build()).toEqual({
testField: {
histogram: {
extended_bounds: {
max: 100,
min: 0
},
field: 'testField',
interval: 10,
min_doc_count: 0,
missing: 0
}
}
});
});
});

@@ -5,229 +5,229 @@ import { Bool } from '../../Builders/Bool';

describe('BoolBulder tests', () => {
test('Create term query', async () => {
const b = new Bool().add(
'must',
'term',
test('Create term query', async () => {
const b = new Bool().add(
'must',
'term',
{
params: { value: '00001851' },
opts: {
boost: 1.0,
},
field: 'articul',
},
);
{
params: {value: '00001851'},
opts: {
boost: 1.0,
},
field: 'articul',
},
);
expect(b.build()).toHaveProperty(
"bool",
expect.objectContaining({ "must": [{ "term": { "articul": "00001851", "boost": 1 } }] })
);
});
test('Create range query', async () => {
const b = new Bool().add(
'filter',
'range',
expect(b.build()).toHaveProperty(
'bool',
expect.objectContaining({'must': [{'term': {'articul': '00001851', 'boost': 1}}]})
);
});
test('Create range query', async () => {
const b = new Bool().add(
'filter',
'range',
{
field: 'price',
opts: {
boost: 1.0,
relation: 'CONTAINS',
time_zone: 'utc+1',
},
params: { gt: 0, lte: 100500 },
},
);
{
field: 'price',
opts: {
boost: 1.0,
relation: 'CONTAINS',
time_zone: 'utc+1',
},
params: {gt: 0, lte: 100500},
},
);
expect(b.build()).toHaveProperty(
'bool',
expect.objectContaining({
filter: [{ range: { price: { boost: 1, gt: 0, lte: 100500, relation: 'CONTAINS', time_zone: 'utc+1' } } }],
}),
);
});
test('Create exists query', async () => {
const b = new Bool().add('filter', 'exists', {
params: {
fieldName: 'price',
},
expect(b.build()).toHaveProperty(
'bool',
expect.objectContaining({
filter: [{range: {price: {boost: 1, gt: 0, lte: 100500, relation: 'CONTAINS', time_zone: 'utc+1'}}}],
}),
);
});
test('Create exists query', async () => {
const b = new Bool().add('filter', 'exists', {
params: {
fieldName: 'price',
},
});
expect(b.build()).toHaveProperty('bool', expect.objectContaining({ filter: [{ exists: { field: 'price' } }] }));
});
test('Create terms query', async () => {
const b = new Bool().add('filter', 'terms', {
params: {
value: ['00001851'],
},
field: 'articul',
opts: {
boost: 2,
},
expect(b.build()).toHaveProperty('bool', expect.objectContaining({filter: [{exists: {field: 'price'}}]}));
});
test('Create terms query', async () => {
const b = new Bool().add('filter', 'terms', {
params: {
value: ['00001851'],
},
field: 'articul',
opts: {
boost: 2,
},
});
expect(b.build()).toHaveProperty(
"bool",
expect.objectContaining({ filter: [{ terms: { articul: ["00001851"], boost: 2 } }] })
);
});
expect(b.build()).toHaveProperty(
'bool',
expect.objectContaining({filter: [{terms: {articul: ['00001851'], boost: 2}}]})
);
});
test('Create extend schema', async () => {
interface IQQ extends BoolSchema {
notExistsFilter: {
params: {
someParams: string;
};
field: string;
};
}
const b = new Bool<IQQ>()
.add('must', 'range', {
field: "price",
params: {
gte: 0,
lte: Number.MAX_VALUE
},
opts: {
boost: 120
test('Create extend schema', async () => {
interface IQQ extends BoolSchema {
notExistsFilter: {
params: {
someParams: string;
};
field: string;
};
}
})
.add('should', 'notExistsFilter', {
field: "test",
params: {
someParams: "some data"
}
});
expect(b.build()).toEqual({
bool: {
must: [
{
range: {
price: {
boost: 120,
gte: 0,
lte: 1.7976931348623157e308
},
const b = new Bool<IQQ>()
.add('must', 'range', {
field: 'price',
params: {
gte: 0,
lte: Number.MAX_VALUE
},
opts: {
boost: 120
}
})
.add('should', 'notExistsFilter', {
field: 'test',
params: {
someParams: 'some data'
}
});
expect(b.build()).toEqual({
bool: {
must: [
{
range: {
price: {
boost: 120,
gte: 0,
lte: 1.7976931348623157e308
},
},
},
],
should: [
{
notExistsFilter: {
test: {
someParams: 'some data'
}
}
}
]
},
},
],
should: [
{
notExistsFilter: {
test: {
someParams: "some data"
}
}
}
]
},
});
});
});
test("Create mutlti query", async () => {
const b = new Bool()
.add("must", "fuzzy", {
field: "f",
params: {
value: "some text"
},
opts: {
fuzziness: "1",
max_expansions: 1,
prefix_length: 3,
rewrite: "constant_score",
transpositions: true
}
})
.add("must", "regexp", {
field: "f",
opts: {
rewrite: "constant_score"
},
params: {
flags: "ALL",
value: "qqqqq"
}
});
test('Create mutlti query', async () => {
const b = new Bool()
.add('must', 'fuzzy', {
field: 'f',
params: {
value: 'some text'
},
opts: {
fuzziness: '1',
max_expansions: 1,
prefix_length: 3,
rewrite: 'constant_score',
transpositions: true
}
})
.add('must', 'regexp', {
field: 'f',
opts: {
rewrite: 'constant_score'
},
params: {
flags: 'ALL',
value: 'qqqqq'
}
});
expect(b.build()).toEqual({
bool: {
must: [
{
fuzzy: {
f: {
fuzziness: "1",
max_expansions: 1,
prefix_length: 3,
rewrite: "constant_score",
transpositions: true,
value: "some text"
}
expect(b.build()).toEqual({
bool: {
must: [
{
fuzzy: {
f: {
fuzziness: '1',
max_expansions: 1,
prefix_length: 3,
rewrite: 'constant_score',
transpositions: true,
value: 'some text'
}
}
},
{
regexp: {
f: {
flags: 'ALL',
rewrite: 'constant_score',
value: 'qqqqq'
}
}
}
]
}
},
{
regexp: {
f: {
flags: "ALL",
rewrite: "constant_score",
value: "qqqqq"
}
}
}
]
}
});
});
});
test("Setters", async () => {
const testTerm = {
params: {
value: "11"
},
field: "test"
};
const b = new Bool()
.Filter("term", testTerm)
.Should("term", testTerm)
.Must("term", testTerm)
.Must_Not("term", testTerm);
test('Setters', async () => {
const testTerm = {
params: {
value: '11'
},
field: 'test'
};
const b = new Bool()
.Filter('term', testTerm)
.Should('term', testTerm)
.Must('term', testTerm)
.Must_Not('term', testTerm);
expect(b.build()).toEqual({
bool: {
filter: [
{
term: {
test: "11"
expect(b.build()).toEqual({
bool: {
filter: [
{
term: {
test: '11'
}
}
],
must: [
{
term: {
test: "11"
}
}
],
must: [
{
term: {
test: '11'
}
}
],
must_not: [
{
term: {
test: "11"
}
}
],
must_not: [
{
term: {
test: '11'
}
}
],
should: [
{
term: {
test: "11"
}
}
],
should: [
{
term: {
test: '11'
}
}
]
}
}
]
}
});
});
});
});
import { Nested } from '../../Builders/Nested';
describe('Nested tests', () => {
test('Create nested query', async () => {
const n = new Nested('myNestedField')
.addProp('query', {
matchAll: {},
})
.addProp('score_mode', 'avg')
.addProp('inner_hits', {
_source: ['mySourceFiled'],
name: 'nestedData',
size: 100500,
});
test('Create nested query', async () => {
const n = new Nested('myNestedField')
.addProp('query', {
matchAll: {},
})
.addProp('score_mode', 'avg')
.addProp('inner_hits', {
_source: ['mySourceFiled'],
name: 'nestedData',
size: 100500,
});
expect(n.build()).toHaveProperty(
'nested',
expect.objectContaining({
inner_hits: { _source: ['mySourceFiled'], name: 'nestedData', size: 100500 },
path: 'myNestedField',
query: { matchAll: {} },
score_mode:'avg'
}),
);
});
expect(n.build()).toHaveProperty(
'nested',
expect.objectContaining({
inner_hits: {_source: ['mySourceFiled'], name: 'nestedData', size: 100500},
path: 'myNestedField',
query: {matchAll: {}},
score_mode: 'avg'
}),
);
});
});
import { Aggregation, Bool, BoolSchema, Query } from '../../index';
describe('ScriptFields tests', () => {
test('Create aggs', async () => {
const q = new Query().addProps(
"aggs",
new Aggregation().add("sum", "agg_sum", {
params: {
field: "price"
}
})
);
expect(q.build()).toEqual({
aggs: {
agg_sum: {
sum: {
field: "price"
}
}
},
query: {}
test('Create aggs', async () => {
const q = new Query().addProps(
'aggs',
new Aggregation().add('sum', 'agg_sum', {
params: {
field: 'price'
}
})
);
expect(q.build()).toEqual({
aggs: {
agg_sum: {
sum: {
field: 'price'
}
}
},
query: {}
});
});
});
test('Create script field ', async () => {
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
})
.addPostFilter(
new Bool<BoolSchema>().Must_Not("exists", {
params: {
fieldName: "test"
}
})
);
test('Create script field ', async () => {
const q = new Query()
.addProps('_source', ['field'])
.addProps('explain', true)
.addProps('from', 0)
.addProps('size', 100)
.addProps('q', 'Lucene query string ')
.addProps('index', 'MyIndex')
.addQuery('match', {
message: {
query: 'query'
}
})
.addQuery('term', {
field: 'f',
value: 'term'
})
.addQuery('range', {
gt: 0,
gte: 0
})
.addPostFilter(
new Bool<BoolSchema>().Must_Not('exists', {
params: {
fieldName: 'test'
}
})
);
q.bool.addBuilder(
"must",
new Bool().add("must", "term", {
field: "articul",
params: {
value: "111"
}
})
);
console.log(JSON.stringify(q.build(), null, 2));
expect(q.isNotEmty()).toEqual(true);
expect(q.build()).toHaveProperty(
"post_filter",
expect.objectContaining({
bool: {
must_not: [
{
exists: {
field: "test"
}
}
]
}
})
);
const { post_filter, ...data } = q.build() as any;
expect(data).toEqual({
_source: ["field"],
explain: true,
from: 0,
q: "Lucene query string ",
query: {
bool: {
must: [
{
bool: {
must: [
{
term: {
articul: "111"
}
},
],
},
q.bool.addBuilder(
'must',
new Bool().add('must', 'term', {
field: 'articul',
params: {
value: '111'
}
})
);
expect(q.isNotEmty()).toEqual(true);
expect(q.build()).toHaveProperty(
'post_filter',
expect.objectContaining({
bool: {
must_not: [
{
exists: {
field: 'test'
}
}
]
}
})
);
const {post_filter, ...data} = q.build() as any;
expect(data).toEqual({
_source: ['field'],
explain: true,
from: 0,
'index': 'MyIndex',
q: 'Lucene query string ',
query: {
bool: {
must: [
{
bool: {
must: [
{
term: {
articul: '111'
}
},
],
},
},
],
},
match: {
message: {
query: 'query',
},
},
range: {
gt: 0,
gte: 0,
},
term: {
field: 'f',
value: 'term',
},
},
],
},
match: {
message: {
query: 'query',
},
},
range: {
gt: 0,
gte: 0,
},
term: {
field: 'f',
value: 'term',
},
},
size: 100,
size: 100,
});
//
});
//
});
});
import { ScriptFields } from '../../Builders/ScriptFields';
describe('ScriptFields tests', () => {
test('Create script field ', async () => {
test('Create script field ', async () => {
const s = new ScriptFields()
.addScript('myScriptField', "doc['price'].value * params.factor", {
factor: 2.0,
})
.build();
const s = new ScriptFields()
.addScript('myScriptField', 'doc[\'price\'].value * params.factor', {
factor: 2.0,
})
.build();
expect(s).toHaveProperty(
'script_fields',
expect.objectContaining({
myScriptField: { script: { params: { factor: 2 }, source: "doc['price'].value * params.factor" } },
}),
);
});
expect(s).toHaveProperty(
'script_fields',
expect.objectContaining({
myScriptField: {script: {params: {factor: 2}, source: 'doc[\'price\'].value * params.factor'}},
}),
);
});
});
import { TEXT } from '../../Builders/Text';
describe('TEXT tests', () => {
test('Create match query ', async () => {
const t = new TEXT()
test('Create match query ', async () => {
const t = new TEXT()
.add('match', {
field: 'testField',
params: {
query: 'search text'
},
opts: {
max_expansions: 1,
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
fuzziness: '6',
operator: 'AND',
prefix_length: 15,
fuzzy_transpositions: true
}
})
.add('match', {
field: 'testField',
params: {
query: 'search text'
},
opts: {
max_expansions: 1,
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
fuzziness: '6',
operator: 'AND',
prefix_length: 15,
fuzzy_transpositions: true
}
})
.build();
.build();
expect(t).toHaveProperty(
'match',
expect.objectContaining({
testField: {
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
fuzziness: '6',
fuzzy_transpositions: true,
max_expansions: 1,
operator: 'AND',
prefix_length: 15,
query: 'search text'
}
})
);
});
test('Create query_string ', async () => {
const t = new TEXT()
expect(t).toHaveProperty(
'match',
expect.objectContaining({
testField: {
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
fuzziness: '6',
fuzzy_transpositions: true,
max_expansions: 1,
operator: 'AND',
prefix_length: 15,
query: 'search text'
}
})
);
});
test('Create query_string ', async () => {
const t = new TEXT()
.add('query_string', {
params: {
query: 'search text'
},
opts: {
default_field: 'my_text',
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
operator: 'AND',
fuzzy_transpositions: true
}
})
.add('query_string', {
params: {
query: 'search text'
},
opts: {
default_field: 'my_text',
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
operator: 'AND',
fuzzy_transpositions: true
}
})
.build();
.build();
expect(t).toHaveProperty(
'query_string',
expect.objectContaining({
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
default_field: 'my_text',
fuzzy_transpositions: true,
operator: 'AND',
query: 'search text'
})
);
});
expect(t).toHaveProperty(
'query_string',
expect.objectContaining({
analyzer: 'russian',
auto_generate_synonyms_phrase_query: true,
default_field: 'my_text',
fuzzy_transpositions: true,
operator: 'AND',
query: 'search text'
})
);
});
});
export abstract class AbstractBulder {
public abstract build(): object;
public abstract isNotEmty(): boolean;
public abstract build(): object;
public abstract isNotEmty(): boolean;
}

@@ -6,16 +6,16 @@ /**

export interface Schema {
[key: string]: {
/**
* Query conditions
*/
params: unknown;
/**
* Query options
*/
opts?: unknown;
/**
* The field by which the request will be
*/
field?: string;
};
[key: string]: {
/**
* Query conditions
*/
params: unknown;
/**
* Query options
*/
opts?: unknown;
/**
* The field by which the request will be
*/
field?: string;
};
}

@@ -28,7 +28,7 @@

export interface AggSchema {
[key: string]: {
params?: unknown;
opts?: unknown;
[key: string]: {
params?: unknown;
opts?: unknown;
};
};
}

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

export class Aggregation<SCHEMA extends AggregationSchema> extends AbstractBulder {
private _data = {};
public add<Type extends keyof SCHEMA>(aggType: Type, name: string, d: SCHEMA[Type]) {
const { filter, subAgg, ...all } = d.params as { filter?: any; subAgg?: any };
let sub = {};
if (subAgg) {
sub = {
aggs: {
...subAgg,
},
};
}
if (filter) {
this._data[name] = {
filter,
aggs: {
[`${name}_filtered`]: {
private _data: any = {};
public add<Type extends keyof SCHEMA>(aggType: Type, name: string, d: SCHEMA[Type]) {
const {filter, subAgg, ...all} = d.params as { filter?: any; subAgg?: any };
let sub = {};
if (subAgg) {
sub = {
aggs: {
...subAgg,
},
};
}
if (filter) {
this._data[name] = {
filter,
aggs: {
[`${name}_filtered`]: {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
},
},
};
return this;
}
this._data[name] = {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
},
},
};
return this;
};
return this;
}
this._data[name] = {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
};
return this;
}
public addCustom(name: string, cutsomAgg: object) {
this._data[name] = cutsomAgg;
}
public addCustom(name: string, cutsomAgg: object) {
this._data[name] = cutsomAgg;
}
public build(): object {
return this._data;
}
public build(): object {
return this._data;
}
public isNotEmty(): boolean {
return Object.keys(this._data).length > 0;
}
public isNotEmty(): boolean {
return Object.keys(this._data).length > 0;
}
}

@@ -5,117 +5,118 @@ import { AggSchema } from '../../Abstract/Schema';

export interface SubAggregation {
subAgg?: FilterAggregation;
subAgg?: FilterAggregation;
}
export interface AggregationSchema extends AggSchema {
/**
* @property A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
*/
terms: {
params: {
/**
* @property Field for aggs
*/
field: string;
filter?: FilterAggregation;
/**
* @property subAgg Вложенные sub аггрегации
*/
} & SubAggregation;
opts?: {
/**
* @property Return basket size
*/
size?: number;
/**
* @property It is possible to only return terms that match more than a configured number of hits
*/
min_doc_count?: number;
/**
* @property Filtering Values
*/
include?: string | string[];
exclude?: string | string[];
/**
* A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
*/
terms: {
params: {
/**
* @property field for aggs
*/
field: string;
filter?: FilterAggregation;
/**
* @property subAgg Вложенные sub аггрегации
*/
} & SubAggregation;
opts?: {
/**
* @property Return basket size
*/
size?: number;
/**
* @property It is possible to only return terms that match more than a configured number of hits
*/
min_doc_count?: number;
/**
* @property Filtering Values
*/
include?: string | string[];
exclude?: string | string[];
};
};
};
range: {
params: {
field: string;
filter?: FilterAggregation;
ranges: RangeAggregation;
range: {
params: {
field: string;
filter?: FilterAggregation;
ranges: RangeAggregation;
};
};
};
avg: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
avg: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
};
};
};
max: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
max: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
};
};
};
min: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
min: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
};
};
};
sum: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
sum: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
};
};
};
percentiles: {
params: {
field: string;
filter?: FilterAggregation;
percents?: [number, number, number];
percentiles: {
params: {
field: string;
filter?: FilterAggregation;
percents?: [number, number, number];
};
};
};
value_count: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
value_count: {
params: {
field: string;
filter?: FilterAggregation;
script?: PainLessScript;
};
};
};
nested: {
params: {
path: string;
nested: {
params: {
path: string;
aggs: { [field: string]: object };
aggs: { [field: string]: object };
};
};
};
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;
filter?: 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;
filter?: FilterAggregation;
};
};
};
}
export interface FilterAggregation {
[key: string]: object;
[key: string]: object;
}

@@ -8,103 +8,104 @@ import { AbstractBulder } from '../../Abstract/AbstractBuilder';

export class Bool<BASE_SCHEMA extends BoolSchema = BoolSchema> extends AbstractBulder {
private _query: BoolQueryData = {};
private _query: BoolQueryData = {};
private checkField(type: BoolFields) {
if (!(type in this._query)) {
this._query[type] = [];
public Should<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('should', filter, data);
return this;
}
}
public Should<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('should', filter, data);
return this;
}
public Filter<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('filter', filter, data);
return this;
}
public Filter<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('filter', filter, data);
return this;
}
public Must<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('must', filter, data);
return this;
}
public Must<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('must', filter, data);
return this;
}
public Must_Not<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('must_not', filter, data);
return this;
}
public Must_Not<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]) {
this.add('must_not', filter, data);
return this;
}
/**
* Add bool
* @param type
* @param bool - empty data will skip
* @return {this<BASE_SCHEMA>}
*/
public addBuilder(type: BoolFields, bool: AbstractBulder): this {
this.checkField(type);
bool.isNotEmty() && this._query[type]?.push(bool.build());
return this;
}
/**
* Add bool
* @param type
* @param bool - empty data will skip
* @return {this<BASE_SCHEMA>}
*/
public addBuilder(type: BoolFields, bool: AbstractBulder): this {
this.checkField(type);
bool.isNotEmty() && this._query[type]?.push(bool.build());
return this;
}
/**
* Проверка на наличие добавленых критериев
* @return {boolean}
*/
public isNotEmty(): boolean {
return Object.keys(this._query).filter(field => field.length).length > 0;
}
/**
* Проверка на наличие добавленых критериев
* @return {boolean}
*/
public isNotEmty(): boolean {
return Object.keys(this._query).filter(field => field.length).length > 0;
}
/**
* Add conditions for Bool
* @param type
* @param filter
* @param data
* @returns {this<BASE_SCHEMA>}
*/
public add<K extends keyof BASE_SCHEMA>(type: BoolFields, filter: K, data: BASE_SCHEMA[K]) {
this.checkField(type);
/**
* Add conditions for Bool
* @param type
* @param filter
* @param data
* @returns {this<BASE_SCHEMA>}
*/
public add<K extends keyof BASE_SCHEMA>(type: BoolFields, filter: K, data: BASE_SCHEMA[K]) {
this.checkField(type);
switch (filter) {
case 'exists': {
this._query[type]?.push({
[filter]: {field: (data.params as BASE_SCHEMA['exists']['params']).fieldName},
});
break;
}
case 'term':
case 'terms': {
this._query[type]?.push({
[filter]: {[data['field']!]: (data.params as any)['value'], ...(data.opts as object)},
});
break;
}
switch (filter) {
case 'exists': {
this._query[type]?.push({
[filter]: { field: (data.params as BASE_SCHEMA['exists']['params']).fieldName }
});
break;
}
case 'term':
case 'terms': {
this._query[type]?.push({
[filter]: { [data['field']!]: (data.params as object)['value'], ...(data.opts as object) }
});
break;
}
default: {
let payload = {...(data.params as object)};
if (data?.opts) {
payload = {...payload, ...(data.opts as object)};
}
default: {
let payload = { ...(data.params as object) };
if (data?.opts) {
payload = { ...payload, ...(data.opts as object) };
this._query[type]?.push({
[filter]: {[data['field']!]: payload},
});
}
}
this._query[type]?.push({
[filter]: { [data['field']!]: payload }
});
}
return this;
}
return this;
}
/**
* Generate Json
* @returns {{bool: BoolQueryData}}
*/
public build() {
const bool: BoolQueryData = {};
let field: keyof BoolQueryData;
for (field in this._query) {
if (this._query?.[field]?.length) {
bool[field] = this._query[field];
}
}
return {bool};
}
/**
* Generate Json
* @returns {{bool: BoolQueryData}}
*/
public build() {
const bool: BoolQueryData = {};
for (const field in this._query) {
if (this._query[field].length) {
bool[field] = this._query[field];
}
private checkField(type: BoolFields) {
if (!(type in this._query)) {
this._query[type] = [];
}
}
return { bool };
}
}

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

} from '../../Types/QueryOptions';
import { TextSchema } from '../Text/types';

@@ -36,3 +37,3 @@ /**

*/
export interface BoolSchema extends Schema {
export interface IBoolSchema extends Schema {
range: {

@@ -60,12 +61,12 @@ field: string;

opts?:
| Analyzer
| AutoGenerateSynonymsPhraseQuery
| Fuzziness
| MaxExpansions
| PrefixLength
| FuzzyTranspositions
| Lenient
| Operator
| MinimumShouldMatch
| ZeroTermsQuery;
| Analyzer
| AutoGenerateSynonymsPhraseQuery
| Fuzziness
| MaxExpansions
| PrefixLength
| FuzzyTranspositions
| Lenient
| Operator
| MinimumShouldMatch
| ZeroTermsQuery;
};

@@ -137,10 +138,5 @@ term: {

};
wildcard: {
field: string;
params: {
value: string;
};
opts?: Rewrite | Boost;
};
}
export type BoolSchema = IBoolSchema & TextSchema;

@@ -1,9 +0,7 @@

import {AggregationSchema} from '../Aggregation/types';
import {Bool} from '../Bool';
import {AbstractBulder} from '../../Abstract/AbstractBuilder';
import { AggregationSchema } from 'Builders/Aggregation/types';
import { Bool } from 'Builders/Bool';
interface IFacet {
[key: string]: object;
inactive: InactiveFacet;
active: any;
inactive: InactiveFacet;
}

@@ -15,65 +13,64 @@

export class EshopFacets extends AbstractBulder {
private _facets: IFacet = {
inactive: {
aggs: {},
filter: {},
},
};
export class EshopFacets {
private _facets: IFacet = {
active: {},
inactive: {
aggs: {},
filter: {},
},
};
public setupInactiveFacets(filter: Bool): void {
this._facets.inactive!.filter = filter.build();
}
public setupInactiveFacets(filter: Bool): void {
this._facets.inactive!.filter = filter;
}
public add<Type extends keyof AggregationSchema>(
facetType: FacetType,
aggType: Type,
name: string,
d: AggregationSchema[Type],
) {
const {filter, subAgg, ...all} = d.params as { filter?: object; subAgg?: object };
let sub = {};
let data = {};
if (subAgg) {
sub = {
aggs: {
...subAgg,
},
};
}
if (filter) {
data = {
filter,
aggs: {
[`${name}_filtered`]: {
public addInactiveFacet<Type extends keyof AggregationSchema>(
facetType: FacetType,
aggType: Type,
name: string,
d: AggregationSchema[Type],
) {
const {filter, subAgg, ...all} = d.params as { filter?: any; subAgg?: any };
let sub = {};
if (subAgg) {
sub = {
aggs: {
...subAgg,
},
};
}
if (filter) {
this._facets[facetType][name] = {
filter,
aggs: {
[`${name}_filtered`]: {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
},
},
};
return this;
}
this._facets[facetType][name] = {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
},
},
};
} else {
data = {
[aggType]: {...all, ...((d.opts as object) || {})},
...sub,
};
};
return this;
}
facetType === 'inactive' ? (this._facets['inactive']['aggs'][name] = data) : (this._facets[name] = data);
return this;
}
public addCustom(facetType: FacetType, name: string, cutsomAgg: object) {
this._facets[facetType][name] = cutsomAgg;
}
public addCustom(facetType: FacetType, name: string, cutsomAgg: object) {
facetType === 'inactive' ? (this._facets['inactive']['aggs'][name] = cutsomAgg) : (this._facets[name] = cutsomAgg);
}
public build(): object {
if (Object.keys(this._facets.inactive.aggs).length > 0 && Object.keys(this._facets.inactive.filter).length < 1) {
throw new Error('Please setup inactive facets');
}
return this._facets;
}
public build(): object {
if (Object.keys(this._facets.inactive.aggs).length > 0 && Object.keys(this._facets.inactive.filter).length < 1) {
throw new Error('Please setup inactive facets');
public isNotEmty(): boolean {
return Object.keys({...this._facets.active, ...this._facets.inactive.aggs}).length > 0;
}
return this._facets;
}
public isNotEmty(): boolean {
return Object.keys({...this._facets, ...this._facets.inactive.aggs}).length > 1;
}
}

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

export class Nested extends AbstractBulder {
private readonly _query: NestedSchema;
private readonly _query: NestedSchema;
constructor(path: string) {
super();
this._query = {
path,
};
}
constructor(path: string) {
super();
this._query = {
path,
};
}
public addProp<K extends keyof Omit<NestedSchema, 'path'>>(prop: K, data: NestedSchema[K]) {
this._query[prop] = data;
public addProp<K extends keyof Omit<NestedSchema, 'path'>>(prop: K, data: NestedSchema[K]) {
this._query[prop] = data;
return this;
}
return this;
}
public isNotEmty(): boolean {
return Boolean(this._query?.path && this._query?.query);
}
public isNotEmty(): boolean {
return Boolean(this._query?.path && this._query?.query);
}
public build() {
return {
nested: this._query,
};
}
public build() {
return {
nested: this._query,
};
}
}

@@ -15,10 +15,10 @@ import { ScoreMode } from '../../Types';

export interface NestedSchema {
path: string;
query?: object;
score_mode?: ScoreMode;
inner_hits?: {
name: string;
size?: number;
_source?: string[];
};
path: string;
query?: object;
score_mode?: ScoreMode;
inner_hits?: {
name: string;
size?: number;
_source?: string[];
};
}
import { AbstractBulder } from '../../Abstract/AbstractBuilder';
export class ScriptFields extends AbstractBulder {
private _scripts = {
script_fields: {},
};
private _scripts: any = {
script_fields: {},
};
public isNotEmty(): boolean {
return Object.keys(this._scripts.script_fields).length > 0;
}
public isNotEmty(): boolean {
return Object.keys(this._scripts.script_fields).length > 0;
}
public addScript(fieldName: string, source: string, params: object = {}) {
this._scripts.script_fields[fieldName] = {
script: {
source,
params,
},
};
return this;
}
public build() {
return this._scripts;
}
public addScript(fieldName: string, source: string, params: object = {}) {
this._scripts.script_fields[fieldName] = {
script: {
source,
params,
},
};
return this;
}
public build() {
return this._scripts;
}
}

@@ -5,41 +5,41 @@ import { AbstractBulder } from '../..';

export class TEXT<BASE_SCHEMA extends TextSchema> extends AbstractBulder {
private _query: object = {};
private _query: object = {};
/**
* Проверка на наличие добавленых критериев
* @return {boolean}
*/
public isNotEmty(): boolean {
return Object.keys(this._query).filter(field => field.length).length > 0;
}
/**
* Проверка на наличие добавленых критериев
* @return {boolean}
*/
public isNotEmty(): boolean {
return Object.keys(this._query).filter(field => field.length).length > 0;
}
/**
* Add conditions for Bool
* @param filter
* @param data
* @returns {this<BASE_SCHEMA>}
*/
public add<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]): Omit<this, 'add'> {
if (data.field) {
this._query = {
[filter]: {
[data.field]: { ...(data.params as object), ...(data.opts as object) }
/**
* Add conditions for Bool
* @param filter
* @param data
* @returns {this<BASE_SCHEMA>}
*/
public add<K extends keyof BASE_SCHEMA>(filter: K, data: BASE_SCHEMA[K]): Omit<this, 'add'> {
if (data.field) {
this._query = {
[filter]: {
[data.field]: {...(data.params as object), ...(data.opts as object)}
}
};
} else {
this._query = {
[filter]: {...(data.params as object), ...(data.opts as object)}
};
}
};
} else {
this._query = {
[filter]: { ...(data.params as object), ...(data.opts as object) }
};
return this;
}
return this;
}
/**
* Generate Json
* @returns {object}
*/
public build() {
return this._query;
}
/**
* Generate Json
* @returns {object}
*/
public build() {
return this._query;
}
}

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

Boost,
CaseInsensitive,
DefaultField,

@@ -18,2 +19,3 @@ Fuzziness,

PrefixLength,
Rewrite,
ZeroTermsQuery

@@ -44,11 +46,11 @@ } from '../../Types/QueryOptions';

opts?: Fuzziness &
MaxExpansions &
PrefixLength &
MinimumShouldMatch &
FuzzyTranspositions &
Lenient &
Operator &
Analyzer &
ZeroTermsQuery &
AutoGenerateSynonymsPhraseQuery;
MaxExpansions &
PrefixLength &
MinimumShouldMatch &
FuzzyTranspositions &
Lenient &
Operator &
Analyzer &
ZeroTermsQuery &
AutoGenerateSynonymsPhraseQuery;
};

@@ -68,13 +70,13 @@ match_phrase: {

opts?: AllowLeadingWildcard &
AutoGenerateSynonymsPhraseQuery &
Boost &
Operator &
Analyzer &
DefaultField &
FuzzyTranspositions &
FuzzyPrefixLength &
FuzzyTranspositions &
FuzzyPrefixLength &
Lenient &
AnalyzeWildcard;
AutoGenerateSynonymsPhraseQuery &
Boost &
Operator &
Analyzer &
DefaultField &
FuzzyTranspositions &
FuzzyPrefixLength &
FuzzyTranspositions &
FuzzyPrefixLength &
Lenient &
AnalyzeWildcard;
};

@@ -88,2 +90,9 @@ combined_fields: {

};
wildcard: {
params: {
query: string;
fields: string;
};
opts?: Boost & Rewrite & CaseInsensitive;
};
}

@@ -16,2 +16,17 @@ import { AbstractBulder } from '../Abstract/AbstractBuilder';

/**
* Auto init bool in query and get object ref
* @returns {Bool<BoolSchema>}
*/
get bool(): Bool<BOOL_SCHEMA> {
if (this.isNotExistInQuery('bool')) {
this._query.bool = new Bool();
}
return this._query.bool!;
}
get postFilter(): Bool<BOOL_SCHEMA> {
return this._post_filter;
}
/**
* Add basic props to Query (size,from,_source,etc...)

@@ -38,17 +53,2 @@ * @param prop

/**
* Auto init bool in query and get object ref
* @returns {Bool<BoolSchema>}
*/
get bool(): Bool<BOOL_SCHEMA> {
if (this.isNotExistInQuery('bool')) {
this._query.bool = new Bool();
}
return this._query.bool!;
}
get postFilter(): Bool<BOOL_SCHEMA> {
return this._post_filter;
}
public addPostFilter(bool: Bool<BOOL_SCHEMA>) {

@@ -59,6 +59,2 @@ this._post_filter = bool;

private isNotExistInQuery(prop: keyof RawQuery['query']) {
return !(prop in this._query);
}
/**

@@ -69,4 +65,4 @@ * Generate Json

public build(opts: Partial<{ withoutAggs: boolean }> = {}): object {
const { withoutAggs } = opts;
const obj = {};
const {withoutAggs} = opts;
const obj: any = {};
for (const [prop, val] of Object.entries(this._props)) {

@@ -89,6 +85,6 @@ switch (prop) {

}
let query = {};
let query: any = {};
for (const [prop, val] of Object.entries(this._query)) {
if (val instanceof AbstractBulder) {
query = { ...query, ...(val as AbstractBulder).build() };
query = {...query, ...(val as AbstractBulder).build()};
continue;

@@ -106,4 +102,8 @@ }

public isNotEmty(): boolean {
return Object.values({ ...(this._query as object), ...(this._query as object) }).flat().length > 0;
return Object.values({...(this._query as object), ...(this._query as object)}).flat().length > 0;
}
private isNotExistInQuery(prop: keyof RawQuery['query']) {
return !(prop in this._query);
}
}

@@ -17,2 +17,3 @@ import { AggregationSchema, EshopFacets } from '..';

* @param _source Source select data
* @param index Index for search
*

@@ -26,2 +27,3 @@ * @type RawQuery

q?: string;
index?: string;
query: {

@@ -28,0 +30,0 @@ match?: Record<'message', Record<'query', string>>;

@@ -12,6 +12,6 @@ /**

export interface Range {
gt?: number | Date;
gte?: number | Date;
lt?: number | Date;
lte?: number | Date;
gt?: number | Date;
gte?: number | Date;
lt?: number | Date;
lte?: number | Date;
}

@@ -34,4 +34,4 @@

export interface PainLessScript {
source: string;
params: object;
source: string;
params: object;
}

@@ -168,8 +168,16 @@ export interface Boost {

rewrite?:
| 'constant_score'
| 'constant_score_boolean'
| 'scoring_boolean'
| 'top_terms_blended_freqs_N'
| 'top_terms_boost_N'
| 'top_terms_N';
| 'constant_score'
| 'constant_score_boolean'
| 'scoring_boolean'
| 'top_terms_blended_freqs_N'
| 'top_terms_boost_N'
| 'top_terms_N';
}
export interface CaseInsensitive {
/**
* Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping.
*/
case_insensitive?: boolean;
}
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