├── .dockerignore ├── .github └── workflows │ └── tests.yml ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── docker-compose.yaml ├── package-lock.json ├── package.json ├── scripts └── wait_es.sh ├── src ├── agg.ts ├── cluster.ts ├── compiler.ts ├── document.ts ├── expression.ts ├── index.ts ├── result.ts ├── search.ts ├── types.ts └── util.ts ├── tests ├── fixtures.ts ├── integ │ ├── cluster.test.ts │ ├── instanceMapper.test.ts │ ├── search.test.ts │ └── utils.ts └── unit │ ├── agg.test.ts │ ├── compileSearchQuery.test.ts │ ├── doc.spec.ts │ ├── field.test.ts │ ├── searchQuery.test.ts │ └── util.test.ts ├── tsconfig.json ├── tslint.json └── website ├── .gitignore ├── README.md ├── docs ├── CHANGELOG.md ├── aggregations.md ├── api.md ├── api │ ├── classes │ │ ├── _agg_.aggexpression.md │ │ ├── _agg_.aggresult.md │ │ ├── _agg_.bucket.md │ │ ├── _agg_.bucketagg.md │ │ ├── _agg_.filter.md │ │ ├── _agg_.multibucketagg.md │ │ ├── _agg_.multibucketaggresult.md │ │ ├── _agg_.singlebucketagg.md │ │ ├── _agg_.singlebucketaggresult.md │ │ ├── _agg_.terms.md │ │ ├── _cluster_.cluster.md │ │ ├── _cluster_.esversion.md │ │ ├── _cluster_.index.md │ │ ├── _compiler_.compilervisitor.md │ │ ├── _document_.booleantype.md │ │ ├── _document_.datetype.md │ │ ├── _document_.doc.md │ │ ├── _document_.field.md │ │ ├── _document_.fieldtype.md │ │ ├── _document_.floattype.md │ │ ├── _document_.integertype.md │ │ ├── _document_.stringtype.md │ │ ├── _expression_.bool.md │ │ ├── _expression_.expression.md │ │ ├── _expression_.fieldexpression.md │ │ ├── _expression_.fieldqueryexpression.md │ │ ├── _expression_.literal.md │ │ ├── _expression_.params.md │ │ ├── _expression_.paramsexpression.md │ │ ├── _expression_.queryexpression.md │ │ ├── _expression_.rangeexpr.md │ │ ├── _expression_.sort.md │ │ ├── _expression_.source.md │ │ ├── _expression_.term.md │ │ ├── _expression_.terms.md │ │ ├── _result_.result.md │ │ ├── _result_.searchresult.md │ │ ├── _search_.searchquery.md │ │ └── _search_.searchquerycontext.md │ └── modules │ │ ├── _agg_.md │ │ ├── _cluster_.md │ │ ├── _compiler_.md │ │ ├── _document_.md │ │ ├── _expression_.md │ │ ├── _index_.md │ │ ├── _result_.md │ │ ├── _search_.md │ │ ├── _types_.md │ │ └── _util_.md ├── getting_started.md ├── installation.md ├── instance_mapper.md └── querying.md ├── docusaurus.config.js ├── package-lock.json ├── package.json ├── sidebars.js ├── src ├── css │ └── custom.css └── pages │ ├── index.js │ └── styles.module.css └── static ├── CNAME └── img ├── favicon.ico ├── logo.svg ├── undraw_docusaurus_mountain.svg ├── undraw_docusaurus_react.svg └── undraw_docusaurus_tree.svg /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .git 4 | dist 5 | .vscode 6 | .github 7 | .idea 8 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [8.x, 10.x, 12.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: npm install and test 21 | run: | 22 | npm ci 23 | docker-compose up -d es6 24 | ./scripts/wait_es.sh localhost:9200 25 | npm run test:ci 26 | env: 27 | CI: true 28 | - name: stop elasticsearch docker container 29 | run: docker-compose down 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | dist -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "launch", 7 | "name": "Jest All", 8 | "program": "${workspaceFolder}/node_modules/.bin/jest", 9 | "args": ["--runInBand"], 10 | "console": "integratedTerminal", 11 | "internalConsoleOptions": "neverOpen", 12 | "disableOptimisticBPs": true, 13 | "env": { 14 | "ES_HOST": "localhost" 15 | }, 16 | "windows": { 17 | "program": "${workspaceFolder}/node_modules/jest/bin/jest", 18 | } 19 | }, 20 | { 21 | "type": "node", 22 | "request": "launch", 23 | "name": "Jest Current File", 24 | "program": "${workspaceFolder}/node_modules/.bin/jest", 25 | "args": [ 26 | "${fileBasenameNoExtension}", 27 | "--config", 28 | "jest.config.js" 29 | ], 30 | "console": "integratedTerminal", 31 | "internalConsoleOptions": "neverOpen", 32 | "disableOptimisticBPs": true, 33 | "windows": { 34 | "program": "${workspaceFolder}/node_modules/jest/bin/jest", 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12-alpine 2 | 3 | ENV NODE_PATH=/node_modules 4 | ENV PATH=$PATH:/node_modules/.bin 5 | 6 | WORKDIR / 7 | 8 | RUN apk add bash curl 9 | 10 | COPY package.json /package.json 11 | 12 | RUN npm install -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL:=/bin/bash 2 | 3 | # requires >=19.* version of docker to use buildkit 4 | export DOCKER_BUILDKIT=1 5 | # requires docker-compose >= 1.25.0 version to use buildkit 6 | export COMPOSE_DOCKER_CLI_BUILD=1 7 | 8 | build: 9 | docker build -t base . -f Dockerfile 10 | 11 | test: build 12 | docker-compose run --rm test 13 | 14 | test-unit: build 15 | docker-compose run -e TEST=${TEST} --rm test-unit 16 | 17 | test-integ: build 18 | docker-compose run -e TEST=${TEST} --rm test-integ 19 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | base: 5 | image: base 6 | 7 | test: &test 8 | image: base 9 | working_dir: /app 10 | volumes: 11 | - ./src:/app/src 12 | - ./tests:/app/tests 13 | - ./scripts:/app/scripts 14 | - ./package.json:/app/package.json 15 | - ./tsconfig.json:/app/tsconfig.json 16 | command: | 17 | sh -c ' 18 | ./scripts/wait_es.sh es6:9200; 19 | npm run test 20 | ' 21 | depends_on: 22 | - es6 23 | 24 | test-integ: 25 | <<: *test 26 | command: | 27 | sh -c " 28 | ./scripts/wait_es.sh es6:9200 29 | if [[ ! -z $${TEST} ]]; then 30 | npm run test:one -- $${TEST}; 31 | else 32 | npm run test:integ 33 | fi; 34 | " 35 | 36 | test-unit: 37 | <<: *test 38 | command: | 39 | sh -c " 40 | if [[ ! -z $${TEST} ]]; then 41 | npm run test:one -- $${TEST}; 42 | else 43 | npm run test:unit 44 | fi; 45 | " 46 | 47 | es6: 48 | image: docker.elastic.co/elasticsearch/elasticsearch:6.8.6 49 | ports: 50 | - 9200:9200 51 | environment: 52 | ES_JAVA_OPTS: "-Xms512m -Xmx512m" 53 | XPACK_SECURITY_ENABLED: "false" 54 | discovery.type: single-node 55 | http.host: "0.0.0.0" 56 | http.port: "9200" 57 | transport.tcp.port: "9300" 58 | bootstrap.memory_lock: "true" 59 | network.host: "_site_" 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elasticmagic", 3 | "version": "0.0.5", 4 | "description": "JS orm for elasticsearch.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/kindritskyiMax/elasticmagic-js.git" 8 | }, 9 | "main": "./dist/index.js", 10 | "types": "./dist/index.d.ts", 11 | "files": [ 12 | "/dist" 13 | ], 14 | "scripts": { 15 | "build": "tsc", 16 | "test": "run-p test:unit test:integ", 17 | "test:integ": "ES_HOST=es6 jest tests/integ --runInBand", 18 | "test:unit": "ES_HOST=es6 jest tests/unit", 19 | "test:one": "ES_HOST=es6 jest", 20 | "test:ci": "ES_HOST=localhost jest", 21 | "lint": "tslint -c tslint.json 'src/**/*.ts'", 22 | "lint:test": "tslint -c tslint.json 'tests/**/*.ts'", 23 | "doc:start": "npm --prefix website run start", 24 | "doc:api:build": "rm -r website/docs/api/* && typedoc --out website/docs/api src --plugin typedoc-plugin-markdown --theme docusaurus2 --readme none --hideBreadcrumbs && rm website/docs/api/index.md && rm -r website/website", 25 | "doc:deploy": "GIT_USER=kindritskyiMax CURRENT_BRANCH=master USE_SSH=true npm --prefix website run deploy" 26 | }, 27 | "dependencies": { 28 | "lodash.clonedeep": "4.5.0" 29 | }, 30 | "devDependencies": { 31 | "@elastic/elasticsearch": "6.8.4", 32 | "@types/jest": "24.0.25", 33 | "@types/lodash.clonedeep": "4.5.6", 34 | "@types/node": "13.1.4", 35 | "jest": "24.9.0", 36 | "npm-run-all": "^4.1.5", 37 | "ts-jest": "24.2.0", 38 | "tslint": "5.20.1", 39 | "typescript": "3.7.4" 40 | }, 41 | "author": "Kindritskiy Maksym ", 42 | "license": "Apache License 2.0", 43 | "keywords": [ 44 | "elasticsearch", 45 | "elastic", 46 | "dsl", 47 | "kibana", 48 | "mapping", 49 | "REST", 50 | "search", 51 | "client", 52 | "index" 53 | ], 54 | "engines": { 55 | "node": ">=8" 56 | }, 57 | "jest": { 58 | "verbose": true, 59 | "testURL": "http://localhost", 60 | "testEnvironment": "node", 61 | "transform": { 62 | "^.+\\.ts$": "ts-jest" 63 | }, 64 | "testRegex": "(/tests/.*.(test|spec))\\.ts?$", 65 | "moduleFileExtensions": [ 66 | "ts", 67 | "js", 68 | "json", 69 | "node" 70 | ] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /scripts/wait_es.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HOST=$1 4 | 5 | echo " * Waiting Elasticsearch at: ${HOST} ..." 6 | while true; do 7 | output=`curl -XGET "${HOST}/_cat/health?h=status" -s | tr -d '[[:space:]]'` 8 | if [ -z "${output}" ]; then 9 | echo -n "." 10 | else 11 | echo " > Elasticsearch status: ${output}" 12 | fi 13 | if [ "${output}" = "green" -o "${output}" = "yellow" ]; then 14 | break 15 | fi 16 | sleep 1; 17 | done 18 | echo " * Elasticsearch is ready!" 19 | -------------------------------------------------------------------------------- /src/cluster.ts: -------------------------------------------------------------------------------- 1 | import { ApiResponse, Client } from '@elastic/elasticsearch'; 2 | import { Doc } from './document'; 3 | import { Query, SearchParams, SearchQuery, SearchQueryContext, SearchQueryOptions } from './search'; 4 | import { SearchResult } from './result'; 5 | import { Nullable, RawResultBody } from './types'; 6 | import { isString } from './util'; 7 | 8 | type RootRawResult = { 9 | name: string; 10 | cluster_name: string; 11 | cluster_uuid: string; 12 | version: { 13 | number: string; 14 | } 15 | }; 16 | 17 | export class Index { 18 | constructor( 19 | private name: string, 20 | private cluster: Cluster, 21 | ) {} 22 | 23 | public searchQuery(searchQueryOptions: SearchQueryOptions): SearchQuery { 24 | return this.cluster.searchQuery(searchQueryOptions); 25 | } 26 | 27 | public getName(): string { 28 | return this.name; 29 | } 30 | 31 | public getCluster(): Cluster { 32 | return this.cluster; 33 | } 34 | } 35 | 36 | class EsVersion { 37 | constructor(public major: number, public minor: number, public patch: number) {} 38 | } 39 | 40 | export class Cluster { 41 | private index?: Index; 42 | private esVersion?: EsVersion; 43 | 44 | constructor( 45 | private client: Client, 46 | indexName?: string, 47 | ) { 48 | if (indexName) { 49 | this.index = new Index(indexName, this); 50 | } 51 | } 52 | 53 | public searchQuery(searchQueryOptions: SearchQueryOptions = {}): SearchQuery { 54 | return new SearchQuery({ 55 | cluster: this, 56 | index: this.index, 57 | ...searchQueryOptions, 58 | }); 59 | } 60 | 61 | public getIndex(): Nullable { 62 | return this.index; 63 | } 64 | 65 | public withIndex(index: string | Index): this { 66 | if (isString(index)) { 67 | this.index = new Index(index, this); 68 | } else { 69 | this.index = index; 70 | } 71 | return this; 72 | } 73 | 74 | public async getEsVersion(): Promise { 75 | if (this.esVersion) { return this.esVersion; } 76 | const rawResult: ApiResponse = await this.client.info(); 77 | return this.processEsVersionResult(rawResult.body); 78 | } 79 | 80 | private processEsVersionResult(rawResult: RootRawResult): EsVersion { 81 | const versionString = rawResult.version.number; 82 | const [version] = versionString.split('-'); 83 | const [major, minor, patch] = version.split('.').map(Number); 84 | return new EsVersion(major, minor, patch); 85 | } 86 | 87 | /** 88 | * Make a request using underlying es client. 89 | * @param compiledQuery 90 | * @param params 91 | */ 92 | private async doRequest( 93 | compiledQuery: Query, 94 | params: SearchParams, 95 | ): Promise>> { 96 | // TODO for now we hardcoded search method 97 | // TODO get client method to call, must be a accep-like function in searchQuery 98 | if (!this.index) { 99 | throw new Error('index required'); 100 | } 101 | return this.client.search({ 102 | body: compiledQuery, 103 | index: this.index.getName(), 104 | ...params, 105 | }); 106 | } 107 | 108 | /** 109 | * returns SearchResult instance with processed raw es response. 110 | * 111 | * @param rawResultBody \ 112 | * @param searchQueryContext 113 | */ 114 | private processResult( 115 | rawResultBody: RawResultBody, 116 | searchQueryContext: SearchQueryContext, 117 | ): SearchResult { 118 | return new SearchResult( 119 | rawResultBody, 120 | searchQueryContext.aggregations, 121 | searchQueryContext.docClasses, 122 | searchQueryContext.instanceMapper, 123 | ); 124 | } 125 | 126 | /** 127 | * run search query against elasticsearch cluster and return processed result. 128 | * @param searchQuery 129 | */ 130 | public async search(searchQuery: SearchQuery): Promise> { 131 | const rawResultResponse: ApiResponse> = await this.doRequest( 132 | searchQuery.toJSON(), 133 | searchQuery.params, 134 | ); 135 | return this.processResult( 136 | rawResultResponse.body, 137 | searchQuery.getQueryContext(), 138 | ); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/document.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Bool, 3 | Expression, 4 | RangeExpr, 5 | RangeValue, 6 | Sort, 7 | SortOpts, 8 | Term, 9 | Terms, 10 | TermValue, 11 | } from './expression'; 12 | import { SearchResult } from './result'; 13 | import { Hit } from './types'; 14 | 15 | export class FieldType {} 16 | 17 | export class IntegerType extends FieldType {} 18 | 19 | export class BooleanType extends FieldType {} 20 | 21 | export class DateType extends FieldType {} 22 | 23 | export class FloatType extends FieldType {} 24 | 25 | export class StringType extends FieldType {} 26 | 27 | export type FieldOpts = { 28 | name?: string; 29 | parent?: DocClass; 30 | }; 31 | 32 | export class Field extends Expression { 33 | public readonly visitName = 'field'; 34 | 35 | constructor( 36 | private type: FieldType, 37 | public readonly name: string, 38 | public readonly parent: DocClass, 39 | ) { 40 | super(); 41 | } 42 | 43 | public in(terms: TermValue[]): Terms { 44 | return new Terms(this, terms); 45 | } 46 | 47 | public not(term: TermValue): Bool { 48 | return Bool.mustNot(new Term(this, term)); 49 | } 50 | 51 | public eq(other: TermValue): Term { 52 | // TODO add if other is None: return self.missing() 53 | return new Term(this, other); 54 | } 55 | 56 | public lt(other: RangeValue): RangeExpr { 57 | return new RangeExpr(this, { lt: other }); 58 | } 59 | 60 | public gt(other: RangeValue): RangeExpr { 61 | return new RangeExpr(this, { gt: other }); 62 | } 63 | 64 | public lte(other: RangeValue): RangeExpr { 65 | return new RangeExpr(this, { lte: other }); 66 | } 67 | 68 | public gte(other: RangeValue): RangeExpr { 69 | return new RangeExpr(this, { gte: other }); 70 | } 71 | 72 | public asc(opts?: SortOpts): Sort { 73 | return new Sort(this, 'asc', opts); 74 | } 75 | 76 | public desc(opts?: SortOpts): Sort { 77 | return new Sort(this, 'desc', opts); 78 | } 79 | 80 | public getType(): FieldType { 81 | return this.type; 82 | } 83 | 84 | public collectDocClasses(): Readonly { 85 | return this.parent ? [this.parent] : []; 86 | } 87 | } 88 | 89 | type DocOpts = { 90 | hit: Hit; 91 | result: SearchResult; 92 | docType: string; 93 | }; 94 | 95 | export class Doc { 96 | public static readonly docType: string; 97 | public readonly docType: string; 98 | protected hit: Hit; 99 | protected result: SearchResult; 100 | public instance: any; 101 | 102 | public _id: string; 103 | constructor(opts: DocOpts) { 104 | this.hit = opts.hit; 105 | this.result = opts.result; 106 | this.docType = opts.docType; 107 | 108 | this._id = opts.hit._id; 109 | 110 | if (this.hit._source) { 111 | this.populateFromSource(); 112 | } 113 | } 114 | 115 | public static getDocCls(): string { 116 | return this.docType; 117 | } 118 | 119 | /** 120 | * Get instance populated by instance mapper. 121 | */ 122 | public async getInstance(): Promise { 123 | if (this.instance) { 124 | return this.instance; 125 | } 126 | if (this.result) { 127 | await this.result.populateInstances(this.docType); 128 | return this.instance; 129 | } 130 | } 131 | 132 | public setInstance(instance: any) { 133 | this.instance = instance; 134 | } 135 | 136 | private populateFromSource() { 137 | Object.entries(this.hit._source).forEach((hitKV) => { 138 | const fieldName: string = hitKV[0]; 139 | const fieldValue = hitKV[1]; 140 | const _this: any = this; // TODO well you should't see this 141 | _this[fieldName] = fieldValue; 142 | }); 143 | } 144 | } 145 | 146 | export type DocClass = typeof Doc; 147 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Cluster, 3 | Index, 4 | } from './cluster'; 5 | import { 6 | BooleanType, 7 | DateType, 8 | Doc, 9 | Field, 10 | FloatType, 11 | IntegerType, 12 | StringType, 13 | } from './document'; 14 | import { 15 | Bool, 16 | RangeExpr, 17 | Term, 18 | Terms, 19 | } from './expression'; 20 | import { 21 | SearchQuery, 22 | } from './search'; 23 | 24 | export { 25 | Cluster, 26 | Index, 27 | Doc, 28 | Field, 29 | IntegerType, 30 | BooleanType, 31 | DateType, 32 | SearchQuery, 33 | Bool, 34 | RangeExpr, 35 | Term, 36 | Terms, 37 | FloatType, 38 | StringType, 39 | }; 40 | -------------------------------------------------------------------------------- /src/result.ts: -------------------------------------------------------------------------------- 1 | import { AggResult, BucketAgg } from './agg'; 2 | import { Doc, DocClass } from './document'; 3 | import { ParamKV, Params } from './expression'; 4 | import { InstanceMapper } from './search'; 5 | import { Dictionary, Hit, RawResultBody } from './types'; 6 | import { arrayKVToDict } from './util'; 7 | 8 | const DOC_TYPE_FIELD = '_doc_type'; 9 | const DOC_TYPE_NAME_FIELD = `${DOC_TYPE_FIELD}.name`; 10 | 11 | function docClsMap( 12 | docClasses: Readonly, 13 | ): Dictionary { 14 | return arrayKVToDict>( 15 | docClasses.map((cls) => [cls.docType, cls]), 16 | ); 17 | } 18 | 19 | function getDocTypeForHit(hit: Hit): string { 20 | const fields = hit.fields || {}; 21 | const customDocType = fields[DOC_TYPE_NAME_FIELD]; 22 | return customDocType ? customDocType[0] : hit._type; 23 | } 24 | 25 | type InstanceMapperDict = Dictionary>; 26 | 27 | function isInstanceMapperDict(arg: any): arg is InstanceMapperDict { 28 | return arg.constructor.name === 'Object'; 29 | } 30 | 31 | class Result { 32 | constructor(public raw: RawResultBody) {} 33 | 34 | public get prettyRaw(): string { 35 | return JSON.stringify(this.raw, null, 2); 36 | } 37 | } 38 | 39 | export class SearchResult extends Result { 40 | 41 | private queryAggs: Params = new Params(); 42 | private docClsMap: Dictionary = {}; 43 | private instanceMappers: InstanceMapperDict = {}; 44 | private mapperRegistry: any = {}; 45 | 46 | public error: string | undefined; 47 | public took: number; 48 | public timedOut: boolean; 49 | public total: number; 50 | public maxScore: number; 51 | public hits: T[] = []; 52 | public aggregations: Dictionary = {}; 53 | public scrollId: number | undefined; 54 | 55 | constructor( 56 | rawResult: RawResultBody, 57 | aggregations: Params, 58 | private docClasses: Readonly, 59 | instanceMapper?: InstanceMapper | InstanceMapperDict, // TODO pass types 60 | ) { 61 | super(rawResult); 62 | 63 | this.queryAggs = aggregations || new Params(); 64 | this.docClsMap = docClsMap(docClasses); 65 | 66 | if (instanceMapper) { 67 | // TODO although we can check if instanceMapper is a dict 68 | // it is not implemented to accept instanceMapper at a higher level yet 69 | if (isInstanceMapperDict(instanceMapper)) { 70 | this.instanceMappers = instanceMapper; 71 | } else { 72 | this.instanceMappers = arrayKVToDict( 73 | this.docClasses.map((cls) => [cls.docType, instanceMapper]), 74 | ); 75 | } 76 | } 77 | this.error = rawResult.error; 78 | this.took = rawResult.took; 79 | this.timedOut = rawResult.timed_out; 80 | 81 | const hits = rawResult.hits || {}; 82 | this.total = hits.total; 83 | this.maxScore = hits.max_score; 84 | hits.hits.forEach((hit: Hit) => { 85 | const docType = getDocTypeForHit(hit); 86 | // TODO below use some sort of DynamicDocument, because fail if no docClass passed to SearchResult 87 | const docCls = this.docClsMap[docType]; 88 | 89 | // TODO below is a hack 90 | // the propblem is when having class type to create instance from it we need to know its type 91 | // but we have only interface 92 | // The solution unknown by now 93 | this.hits.push(new docCls({ hit, result: this, docType: docCls.docType }) as T); 94 | }); 95 | 96 | this.queryAggs.getParamsKvList().forEach((agg: ParamKV) => { 97 | const aggName: string = agg[0]; 98 | const aggExpr: BucketAgg = agg[1]; 99 | 100 | const rawAggData = (rawResult.aggregations || {})[aggName]; 101 | this.aggregations[aggName] = aggExpr.buildAggResult( 102 | rawAggData, 103 | this.docClsMap, 104 | this.mapperRegistry, 105 | ); 106 | }); 107 | 108 | this.scrollId = rawResult._scroll_id; 109 | } 110 | 111 | public getAggregation(name: string): AggResult { 112 | return this.aggregations[name]; 113 | } 114 | 115 | public getIds(): string[] { 116 | return this.hits.map((hit) => hit._id); 117 | } 118 | 119 | /** 120 | * Populates docs (hits) with result of instance mapper. 121 | */ 122 | public async populateInstances(docType?: string) { 123 | const getHitIds = (docs: Doc[]): string[] => { 124 | return docs.map((doc) => doc._id); 125 | }; 126 | 127 | let instancesMap: Map = new Map(); 128 | 129 | if (docType) { 130 | const mapper = this.instanceMappers[docType]; 131 | if (!mapper) { 132 | throw new Error(`no instance mapper for ${docType} doc type`); 133 | } 134 | instancesMap = await mapper(getHitIds(this.hits)); 135 | } else { 136 | const docTypeDocsMap = this.getDocTypeDocMap(); 137 | docTypeDocsMap.forEach(async (docs, key) => { 138 | const mapper = this.instanceMappers[key]; 139 | if (!mapper) { 140 | throw new Error(`no instance mapper for ${key} doc type`); 141 | } 142 | const mapped = await mapper(getHitIds(docs)); 143 | instancesMap = new Map([...instancesMap, ...mapped]); 144 | }); 145 | } 146 | this.hits.forEach((hit) => { 147 | hit.setInstance(instancesMap.get(hit._id)); 148 | }); 149 | } 150 | 151 | private getDocTypeDocMap(): Map { 152 | const docTypeDocsMap = new Map(); 153 | this.hits.forEach((hit) => { 154 | const key = hit.docType; 155 | if (docTypeDocsMap.get(key) === undefined) { 156 | docTypeDocsMap.set(key, []); 157 | } 158 | docTypeDocsMap.get(key).push(hit); 159 | }); 160 | return docTypeDocsMap; 161 | } 162 | 163 | public async getInstances(): Promise { 164 | await this.populateInstances(); 165 | return Promise.all(this.hits.map(async (hit) => await hit.getInstance())); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | export type Nullable = T | null | undefined; 2 | 3 | export type Dictionary = { 4 | [key in T1]: T2 5 | }; 6 | export type KVList = [T1, T2]; 7 | 8 | export type PlainObject = { [name: string]: any }; 9 | 10 | export function isPlainObject(obj: any): obj is PlainObject { 11 | return obj && obj.constructor === Object || false; 12 | } 13 | 14 | // TODO add generic type for fields behind _source 15 | export type Hit = { 16 | _id: string; 17 | _index?: string; 18 | _routing?: string; 19 | _score?: number; 20 | _type?: string; 21 | _source?: T; 22 | fields?: PlainObject; 23 | }; 24 | 25 | type BucketFields = { doc_count: number; }; 26 | 27 | export type RawAggBucketChild = Dictionary>; 28 | 29 | export type RawAggBucket = { 30 | key: any; 31 | doc_count: number; 32 | } & RawAggBucketChild; // TODO can be rewriten with ts utility types such as Pick, Exclude, Extract 33 | 34 | export type RawAgg = { 35 | doc_count_error_upper_bound: number; 36 | sum_other_doc_count: number; 37 | buckets: RawAggBucket[] 38 | }; 39 | type RawAggs = Dictionary; 40 | 41 | type SearchResponseBody = { 42 | error?: string; 43 | took: number; 44 | timed_out: boolean; 45 | _scroll_id?: number; 46 | _shards: { 47 | total: number; 48 | successful: number; 49 | skipped: number; 50 | failed: number; 51 | }; 52 | hits: { 53 | total: number; 54 | max_score: number; 55 | hits: Array> 56 | }, 57 | aggregations?: RawAggs; 58 | }; 59 | 60 | export type RawResultBody = SearchResponseBody; 61 | -------------------------------------------------------------------------------- /src/util.ts: -------------------------------------------------------------------------------- 1 | import { DocClass } from './document'; 2 | import { Expression, FieldQueryValue, Params, ParamsType } from './expression'; 3 | import { Nullable } from './types'; 4 | 5 | export function arrayKVToDict(array: any[][]): T { 6 | return array.reduce((acc: any, [key, val]) => { 7 | acc[key] = val; 8 | return acc; 9 | }, {}); 10 | } 11 | 12 | /** 13 | * TODO add tests 14 | * Filter keys having null or undefined values 15 | */ 16 | export function cleanParams(params?: Nullable): ParamsType { 17 | if (!params) { return {}; } 18 | 19 | return Object.entries(params) 20 | .reduce((acc: any, [key, val]: any) => { 21 | if (val !== null && val !== undefined) { 22 | acc[key] = val; 23 | } 24 | return acc; 25 | }, {} as ParamsType); 26 | } 27 | 28 | export function isArray(x: any): x is T[] { 29 | return Array.isArray(x) && typeof x.length === 'number'; 30 | } 31 | 32 | export function isString(x: any): x is string { 33 | return typeof x === 'string'; 34 | } 35 | 36 | export function isBoolean(x: any): x is boolean { 37 | return typeof x === 'boolean'; 38 | } 39 | 40 | export function isObject(x: any): x is object { 41 | return x && typeof x === 'object' && x.constructor === Object; 42 | } 43 | 44 | export function isExpression(x: any): x is Expression { 45 | return x instanceof Expression; 46 | } 47 | 48 | export function isNullOrUndef(x: any): x is null | undefined { 49 | return x === null || x === undefined; 50 | } 51 | 52 | export function uniqueArray(items: T[]): T[] { 53 | return Array.from(new Set(items)); 54 | } 55 | export function collectDocClasses( 56 | expr?: Expression | Expression[] | ParamsType | FieldQueryValue, 57 | ): Readonly { 58 | if (isExpression(expr)) { 59 | return expr.collectDocClasses(); 60 | } 61 | 62 | if (isArray(expr)) { 63 | return uniqueArray(flatMap((item) => collectDocClasses(item), expr)); 64 | } 65 | 66 | if (isObject(expr)) { 67 | const kvListChain = Object.keys(expr).concat(Object.values(expr)); 68 | return uniqueArray(flatMap((item) => collectDocClasses(item), kvListChain)); 69 | } 70 | return []; 71 | } 72 | 73 | export function mergeParams(currentParams: Params, newParams: Params): Params { 74 | return new Params({ ...currentParams.getParams(), ...newParams.getParams() }); 75 | } 76 | 77 | export function flatMap(f: (arg: any) => any, arr: any[]): any[] { 78 | return arr.reduce((x, y) => [...x, ...f(y)], []); 79 | } 80 | 81 | export function mustClean(arg: any[] | Nullable): boolean { 82 | if (isBoolean(arg)) { 83 | return false; 84 | } 85 | if (isObject(arg) && Object.keys(arg).length === 0) { 86 | return true; 87 | } 88 | if (isArray(arg) && arg.length === 1) { 89 | return isNullOrUndef(arg[0]); 90 | } 91 | if (isArray(arg) && arg.length === 0) { 92 | return true; 93 | } 94 | return isNullOrUndef(arg) ? true : false; 95 | } 96 | -------------------------------------------------------------------------------- /tests/fixtures.ts: -------------------------------------------------------------------------------- 1 | import { DateType, Doc, Field } from '../src/document'; 2 | 3 | export enum OrderStatus { 4 | new = 1, 5 | paid = 2, 6 | handled = 3, 7 | canceled = 4, 8 | } 9 | 10 | export enum OrderSource { 11 | desktop = 1, 12 | mobile = 2, 13 | } 14 | 15 | export class OrderDoc extends Doc { 16 | public static docType: string = 'order'; 17 | 18 | public static userId = new Field(DateType, 'user_id', OrderDoc); 19 | public user_id?: number; 20 | public static status = new Field(DateType, 'status', OrderDoc); 21 | public status?: number; 22 | 23 | public static source = new Field(DateType, 'source', OrderDoc); 24 | public source?: number; 25 | public static price = new Field(DateType, 'price', OrderDoc); 26 | public price?: number; 27 | public static dateCreated = new Field(DateType, 'date_created', OrderDoc); 28 | public date_created?: Date; 29 | 30 | public static conditionSourceDesktop() { 31 | return OrderDoc.source.in([OrderSource.desktop]); 32 | } 33 | 34 | public static conditionLowPrice() { 35 | return OrderDoc.price.lt(10); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/integ/cluster.test.ts: -------------------------------------------------------------------------------- 1 | import { Client } from '@elastic/elasticsearch'; // TODO maybe replace 2 | import { Cluster } from '../../src/cluster'; 3 | 4 | const esHost = `http://${process.env.ES_HOST}:9200`; 5 | 6 | describe('Cluster integration', () => { 7 | test('should return es version', async () => { 8 | const cluster = new Cluster(new Client({ node: esHost })); 9 | 10 | const esVersion = await cluster.getEsVersion(); 11 | expect(esVersion.major).toBe(6); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /tests/integ/instanceMapper.test.ts: -------------------------------------------------------------------------------- 1 | import { Client } from '@elastic/elasticsearch'; // TODO maybe replace 2 | import { Cluster } from '../../src/cluster'; 3 | import { Bool } from '../../src/expression'; 4 | import { OrderDoc, OrderSource, OrderStatus } from '../fixtures'; 5 | import { getOrderDocMapping, indexDoc } from './utils'; 6 | 7 | let client: Client; 8 | 9 | const DAY = 24 * 3600 * 1000; 10 | 11 | const userId = 1; 12 | const dateCreated = new Date(Date.now() - DAY); 13 | const type = 'order'; 14 | const indexName = 'test_order_index'; 15 | const esHost = `http://${process.env.ES_HOST}:9200`; 16 | 17 | beforeAll(async () => { 18 | client = new Client({ node: esHost }); 19 | // cleanup before all tests 20 | await client.indices.delete({ 21 | index: indexName, 22 | ignore_unavailable: true, 23 | }); 24 | }); 25 | 26 | beforeEach(async () => { 27 | // create index 28 | await client.indices.create({ 29 | index: indexName, 30 | }); 31 | // put mapping 32 | await client.indices.putMapping({ 33 | index: indexName, 34 | // TODO https://www.elastic.co/guide/en/elasticsearch/reference/master/removal-of-types.html 35 | type, 36 | body: getOrderDocMapping(), 37 | }); 38 | await indexDoc( 39 | client, 40 | indexName, 41 | `${userId}`, 42 | { 43 | user_id: userId, 44 | status: OrderStatus.new, 45 | source: OrderSource.desktop, 46 | date_created: dateCreated, 47 | price: 5, 48 | }, 49 | `${userId}`, 50 | ); 51 | }); 52 | 53 | afterEach(async () => { 54 | await client.indices.delete({ 55 | index: indexName, 56 | }); 57 | }); 58 | 59 | describe('Instance Mapper integration', () => { 60 | test('getInstance() Doc method returns object created by instance mapper', async () => { 61 | const cluster = new Cluster(client, indexName); 62 | type Mapped = { id: number; name: string }; 63 | const query = cluster.searchQuery({ routing: userId, docClass: OrderDoc }) 64 | .source(false) 65 | .withInstanceMapper(async (ids: string[]): Promise> => { 66 | return new Map(ids.map((id) => [id, { id: Number(id), name: `test_name_${id}`}])); 67 | }) 68 | .filter( 69 | Bool.must( 70 | OrderDoc.userId.in([userId]), 71 | OrderDoc.status.in([OrderStatus.new, OrderStatus.paid]), 72 | OrderDoc.source.not(OrderSource.mobile), 73 | OrderDoc.dateCreated.lte(new Date().toISOString()), 74 | ), 75 | ); 76 | 77 | const result = await query.getResult(); 78 | expect(result.error).toBeUndefined(); 79 | expect(result.total).toBe(1); 80 | expect(result.hits.length).toBe(1); 81 | 82 | const hit = result.hits[0]; 83 | const instance = await hit.getInstance(); 84 | expect(instance).toStrictEqual({ 85 | id: 1, 86 | name: 'test_name_1', 87 | }); 88 | }); 89 | 90 | test('getInstances() SearchResult method returns list of object created by instance mapper', async () => { 91 | const cluster = new Cluster(client, indexName); 92 | 93 | type Mapped = { id: number; name: string }; 94 | const query = cluster.searchQuery({ routing: userId, docClass: OrderDoc }) 95 | .source(false) 96 | .withInstanceMapper(async (ids: string[]): Promise> => { 97 | return new Map(ids.map((id) => [id, { id: Number(id), name: `test_name_${id}`}])); 98 | }) 99 | .filter( 100 | Bool.must( 101 | OrderDoc.userId.in([userId]), 102 | OrderDoc.status.in([OrderStatus.new, OrderStatus.paid]), 103 | OrderDoc.source.not(OrderSource.mobile), 104 | OrderDoc.dateCreated.lte(new Date().toISOString()), 105 | ), 106 | ); 107 | 108 | const result = await query.getResult(); 109 | expect(result.error).toBeUndefined(); 110 | expect(result.total).toBe(1); 111 | expect(result.hits.length).toBe(1); 112 | 113 | const instances = await result.getInstances(); 114 | expect(instances.length).toBe(1); 115 | expect(instances[0]).toStrictEqual({ 116 | id: 1, 117 | name: 'test_name_1', 118 | }); 119 | }); 120 | }); 121 | -------------------------------------------------------------------------------- /tests/integ/utils.ts: -------------------------------------------------------------------------------- 1 | import { Client } from '@elastic/elasticsearch'; 2 | 3 | const DEFAULT_ORDER_DOC_MAPPING = { 4 | dynamic: false, 5 | _all: { 6 | enabled: false, 7 | }, 8 | _routing: { 9 | required: true, 10 | }, 11 | date_detection: false, 12 | properties: { 13 | user_id: { 14 | type: 'integer', 15 | }, 16 | source: { 17 | type: 'integer', 18 | }, 19 | status: { 20 | type: 'integer', 21 | }, 22 | date_created: { 23 | type: 'date', 24 | }, 25 | price: { 26 | type: 'integer', 27 | }, 28 | }, 29 | }; 30 | 31 | export const getOrderDocMapping = (): object => { 32 | return { ...DEFAULT_ORDER_DOC_MAPPING }; 33 | } 34 | 35 | export const indexDoc = async (client: Client, indexName: string, id: string, body: any, routing: string) => { 36 | await client.index({ 37 | index: indexName, 38 | id, 39 | type: '_doc', // uncomment this line if you are using Elasticsearch ≤ 6 40 | body, 41 | routing, 42 | refresh: 'wait_for', 43 | }); 44 | } -------------------------------------------------------------------------------- /tests/unit/agg.test.ts: -------------------------------------------------------------------------------- 1 | import * as agg from '../../src/agg'; 2 | import { Bool } from '../../src/expression'; 3 | import { SearchQuery } from '../../src/search'; 4 | import { OrderDoc, OrderSource, OrderStatus } from '../fixtures'; 5 | 6 | describe('Aggregations compile', () => { 7 | test('valid aggregations', () => { 8 | const searchQuery = new SearchQuery({}); 9 | const query = searchQuery 10 | .source(false) 11 | .filter( 12 | Bool.must( 13 | OrderDoc.userId.in([1]), 14 | OrderDoc.status.in([OrderStatus.new, OrderStatus.handled, OrderStatus.paid]), 15 | OrderDoc.source.not(OrderSource.mobile), 16 | ), 17 | ) 18 | .aggregations({ 19 | usersOrders: new agg.Terms({ 20 | field: OrderDoc.userId, 21 | size: 1, 22 | aggs: { 23 | total: new agg.Filter({ 24 | filter: OrderDoc.conditionSourceDesktop(), 25 | aggs: { 26 | selled: new agg.Filter({ 27 | filter: Bool.must( 28 | OrderDoc.status.in([OrderStatus.paid, OrderStatus.handled]), 29 | ), 30 | aggs: { 31 | paid: new agg.Filter({ 32 | filter: OrderDoc.status.eq(OrderStatus.paid), 33 | }), 34 | handled: new agg.Filter({ 35 | filter: OrderDoc.status.eq(OrderStatus.handled), 36 | }), 37 | }, 38 | }), 39 | canceled: new agg.Filter({ 40 | filter: OrderDoc.status.eq(OrderStatus.canceled), 41 | }), 42 | new: new agg.Filter({ 43 | filter: OrderDoc.status.eq(OrderStatus.new), 44 | }), 45 | }, 46 | }), 47 | lowcost: new agg.Filter({ 48 | filter: OrderDoc.conditionLowPrice(), 49 | }), 50 | }, 51 | }), 52 | }) 53 | .limit(0); 54 | expect(query.toJSON()).toStrictEqual({ 55 | query: { 56 | bool: { 57 | filter: { 58 | bool: { 59 | must: [ 60 | { 61 | terms: { 62 | user_id: [ 63 | 1, 64 | ], 65 | }, 66 | }, 67 | { 68 | terms: { 69 | status: [ 70 | 1, 71 | 3, 72 | 2, // order is a must 73 | ], 74 | }, 75 | }, 76 | { 77 | bool: { 78 | must_not: [ 79 | { 80 | term: { 81 | source: 2, 82 | }, 83 | }, 84 | ], 85 | }, 86 | }, 87 | ], 88 | }, 89 | }, 90 | }, 91 | }, 92 | _source: false, 93 | aggregations: { 94 | usersOrders: { 95 | terms: { 96 | field: 'user_id', 97 | size: 1, 98 | }, 99 | aggregations: { 100 | total: { 101 | filter: { 102 | terms: { 103 | source: [ 104 | 1, 105 | ], 106 | }, 107 | }, 108 | aggregations: { 109 | selled: { 110 | filter: { 111 | terms: { 112 | status: [2, 3], 113 | }, 114 | }, 115 | aggregations: { 116 | paid: { 117 | filter: { 118 | term: { 119 | status: 2, 120 | }, 121 | }, 122 | }, 123 | handled: { 124 | filter: { 125 | term: { 126 | status: 3, 127 | }, 128 | }, 129 | }, 130 | }, 131 | }, 132 | canceled: { 133 | filter: { 134 | term: { 135 | status: 4, 136 | }, 137 | }, 138 | }, 139 | new: { 140 | filter: { 141 | term: { 142 | status: 1, 143 | }, 144 | }, 145 | }, 146 | }, 147 | }, 148 | lowcost: { 149 | filter: { 150 | range: { 151 | price: { 152 | lt: 10, 153 | }, 154 | }, 155 | }, 156 | }, 157 | }, 158 | }, 159 | }, 160 | size: 0, 161 | }); 162 | }); 163 | 164 | test('can clear aggs', () => { 165 | const searchQuery = new SearchQuery({}); 166 | const query = searchQuery 167 | .aggregations({ 168 | usersOrders: new agg.Terms({ 169 | field: OrderDoc.userId, 170 | size: 1, 171 | }), 172 | }); 173 | 174 | expect(query.toJSON()).toStrictEqual({ 175 | aggregations: { 176 | usersOrders: { 177 | terms: { 178 | field: 'user_id', 179 | size: 1, 180 | }, 181 | }, 182 | }, 183 | }); 184 | 185 | query.aggs(null); 186 | expect(query.toJSON()).not.toHaveProperty('aggregations'); 187 | }); 188 | }); 189 | -------------------------------------------------------------------------------- /tests/unit/doc.spec.ts: -------------------------------------------------------------------------------- 1 | import { Doc } from '../../src/document'; 2 | 3 | describe('Doc', () => { 4 | test('getDocCls', () => { 5 | class MyDoc extends Doc { 6 | public static docType = 'my'; 7 | } 8 | 9 | expect(MyDoc.getDocCls()).toBe('my'); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /tests/unit/field.test.ts: -------------------------------------------------------------------------------- 1 | import { Field, IntegerType } from '../../src/document'; 2 | import { Bool, RangeExpr, Term, Terms } from '../../src/expression'; 3 | import { OrderDoc } from '../fixtures'; 4 | 5 | describe('Field', () => { 6 | test('accept name as 2 positional arg', () => { 7 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 8 | expect(field.name).toBe('id'); 9 | }); 10 | test('accept name in options', () => { 11 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 12 | expect(field.name).toBe('id'); 13 | }); 14 | 15 | test('accept parent in options', () => { 16 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 17 | expect(field.parent).toBe(OrderDoc); 18 | }); 19 | 20 | test('has in operator', () => { 21 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 22 | expect(field.in([1, 2, 3])).toBeInstanceOf(Terms); 23 | }); 24 | 25 | test('has not operator', () => { 26 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 27 | expect(field.not(1)).toBeInstanceOf(Bool); 28 | expect(field.not(1).params.length).toBe(1); 29 | expect(field.not(1).params.getParams()).toStrictEqual({ 30 | must_not: [ 31 | new Term(field, 1), 32 | ], 33 | }); 34 | }); 35 | 36 | test('has eq operator', () => { 37 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 38 | expect(field.eq(false)).toBeInstanceOf(Term); 39 | expect(field.eq(false).query).toBe(false); 40 | // expect(field.eq(null)).toBeInstanceOf(Missing); 41 | }); 42 | 43 | test('has lt operator', () => { 44 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 45 | expect(field.lt(1)).toBeInstanceOf(RangeExpr); 46 | }); 47 | 48 | test('has gt operator', () => { 49 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 50 | expect(field.gt(1)).toBeInstanceOf(RangeExpr); 51 | }); 52 | 53 | test('has lte operator', () => { 54 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 55 | expect(field.lte(1)).toBeInstanceOf(RangeExpr); 56 | }); 57 | 58 | test('has gte operator', () => { 59 | const field: Field = new Field(IntegerType, 'id', OrderDoc); 60 | expect(field.gte(1)).toBeInstanceOf(RangeExpr); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /tests/unit/searchQuery.test.ts: -------------------------------------------------------------------------------- 1 | import * as agg from '../../src/agg'; 2 | import { Source } from '../../src/expression'; 3 | import { SearchQuery } from '../../src/search'; 4 | import { OrderDoc, OrderStatus } from '../fixtures'; 5 | 6 | describe('SearchQuery', () => { 7 | test('collectDocClasses private method', () => { 8 | let searchQuery = new SearchQuery(); 9 | searchQuery = searchQuery.filter(OrderDoc.userId.eq(1)).limit(1); 10 | // @ts-ignore 11 | const collected = searchQuery.collectDocClasses(); 12 | expect(collected.length).toBe(1); 13 | }); 14 | 15 | test('clone of search query is not the same object', () => { 16 | const origQuery = new SearchQuery(); 17 | const sameQuery = origQuery.filter(OrderDoc.userId.eq(1)).limit(1); 18 | expect(Object.is(origQuery, sameQuery)).toBe(true); 19 | // now clone it 20 | const clonedQuery = origQuery.clone(); 21 | expect(Object.is(origQuery, clonedQuery)).toBe(false); 22 | }); 23 | 24 | test('clone of search query has same fields values', () => { 25 | const origQuery = new SearchQuery().filter(OrderDoc.userId.eq(1)).limit(1).source(false); 26 | const clonedQuery = origQuery.clone(); 27 | 28 | // @ts-ignore 29 | expect(origQuery._limit).toBe(1); 30 | // @ts-ignore 31 | expect(clonedQuery._limit).toBe(1); 32 | 33 | // @ts-ignore 34 | expect(origQuery._source).toBeInstanceOf(Source); 35 | // @ts-ignore 36 | expect(origQuery._source.fields).toBe(false); 37 | // @ts-ignore 38 | expect(clonedQuery._source).toBeInstanceOf(Source); 39 | // @ts-ignore 40 | expect(clonedQuery._source.fields).toBe(false); 41 | }); 42 | 43 | test('clone of search query do not change primitive values in original query', () => { 44 | const origQuery = new SearchQuery().filter(OrderDoc.userId.eq(1)).limit(1); 45 | const clonedQuery = origQuery.clone(); 46 | 47 | // primitive types must not be changed in original instance 48 | clonedQuery.limit(5); 49 | // @ts-ignore 50 | expect(origQuery._limit).toBe(1); 51 | // @ts-ignore 52 | expect(clonedQuery._limit).toBe(5); 53 | 54 | // primitive types must not be changed in original instance 55 | origQuery.source(false); 56 | clonedQuery.source(true); 57 | 58 | // @ts-ignore 59 | expect(origQuery._source).toBeInstanceOf(Source); 60 | // @ts-ignore 61 | expect(origQuery._source.fields).toBe(false); 62 | // @ts-ignore 63 | expect(clonedQuery._source).toBeInstanceOf(Source); 64 | // @ts-ignore 65 | expect(clonedQuery._source.fields).toBe(true); 66 | }); 67 | 68 | test('clone of search query do not change reference values (arrays) in original query', () => { 69 | const origQuery = new SearchQuery().filter(OrderDoc.userId.eq(1)).limit(1); 70 | const clonedQuery = origQuery.clone(); 71 | 72 | // reference types such as arrays must not be changed in original instance 73 | clonedQuery.filter(OrderDoc.status.not(OrderStatus.canceled)); 74 | // @ts-ignore 75 | expect(origQuery._filters.length).toBe(1); 76 | // @ts-ignore 77 | expect(clonedQuery._filters.length).toBe(2); 78 | clonedQuery.filter(null); 79 | // @ts-ignore 80 | expect(origQuery._filters.length).toBe(1); 81 | // @ts-ignore 82 | expect(clonedQuery._filters.length).toBe(0); 83 | }); 84 | 85 | test('clone of search query do not change reference values (objects) in original query', () => { 86 | const origQuery = new SearchQuery().filter(OrderDoc.userId.eq(1)).limit(1); 87 | const clonedQuery = origQuery.clone(); 88 | 89 | // reference types such as arrays must not be changed in original instance 90 | clonedQuery.aggs({ 91 | usersOrders: new agg.Terms({ 92 | field: OrderDoc.userId, 93 | size: 1, 94 | }), 95 | }); 96 | // @ts-ignore 97 | expect(origQuery._aggregations.length).toBe(0); 98 | // @ts-ignore 99 | expect(clonedQuery._aggregations.length).toBe(1); 100 | }); 101 | }); 102 | -------------------------------------------------------------------------------- /tests/unit/util.test.ts: -------------------------------------------------------------------------------- 1 | import { Params } from '../../src/expression'; 2 | import { SearchQuery } from '../../src/search'; 3 | import { cleanParams, collectDocClasses, mergeParams, mustClean } from '../../src/util'; 4 | import { OrderDoc } from '../fixtures'; 5 | 6 | describe('Util', () => { 7 | test('collectDocClasses', () => { 8 | let query = new SearchQuery(); 9 | query = query.filter(OrderDoc.userId.eq(1)); 10 | // @ts-ignore 11 | // pass expression 12 | const collected = collectDocClasses(query._filters); 13 | expect(collected.length).toBe(1); 14 | 15 | // pass params type 16 | // pass FieldQueryValue 17 | }); 18 | 19 | test('mergeParams', () => { 20 | const a = { 21 | one: 1, 22 | }; 23 | const b = { 24 | two: 2, 25 | }; 26 | const merged = mergeParams( 27 | new Params(a), 28 | new Params(b), 29 | ); 30 | expect(merged.getParams()).toStrictEqual(new Params({ ...a, ...b}).getParams()); 31 | }); 32 | 33 | test('cleanParams', () => { 34 | const valid = { 35 | one: 1, 36 | }; 37 | const not = { 38 | two: null, 39 | three: undefined, 40 | }; 41 | const cleaned = cleanParams({ 42 | ...valid, 43 | ...not, 44 | }); 45 | expect(cleaned).toStrictEqual(valid); 46 | expect(cleanParams(null)).toStrictEqual({}); 47 | }); 48 | 49 | test('mustClean', () => { 50 | expect(mustClean(true)).toBe(false); 51 | expect(mustClean(false)).toBe(false); 52 | expect(mustClean([])).toBe(true); 53 | expect(mustClean([null])).toBe(true); 54 | expect(mustClean(['1'])).toBe(false); 55 | expect(mustClean([1])).toBe(false); 56 | expect(mustClean({})).toBe(true); 57 | expect(mustClean(null)).toBe(true); 58 | expect(mustClean(undefined)).toBe(true); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "ES6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 6 | "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 7 | "lib": [ 8 | "ES2017", 9 | "DOM" 10 | ], /* Specify library files to be included in the compilation. */ 11 | // "allowJs": true, /* Allow javascript files to be compiled. */ 12 | // "checkJs": true, /* Report errors in .js files. */ 13 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 14 | "declaration": true, /* Generates corresponding '.d.ts' file. */ 15 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 16 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 17 | // "outFile": "./", /* Concatenate and emit output to single file. */ 18 | "outDir": "./dist", /* Redirect output structure to the directory. */ 19 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 20 | // "composite": true, /* Enable project compilation */ 21 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 22 | // "removeComments": true, /* Do not emit comments to output. */ 23 | // "noEmit": true, /* Do not emit outputs. */ 24 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 25 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 26 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 27 | 28 | /* Strict Type-Checking Options */ 29 | "strict": true, /* Enable all strict type-checking options. */ 30 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 31 | // "strictNullChecks": true, /* Enable strict null checks. */ 32 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 33 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 34 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 35 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 36 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 37 | 38 | /* Additional Checks */ 39 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 40 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 41 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 42 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 43 | 44 | /* Module Resolution Options */ 45 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 46 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 47 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 48 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 49 | // "typeRoots": [], /* List of folders to include type definitions from. */ 50 | // "types": [], /* Type declaration files to be included in compilation. */ 51 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 52 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 53 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 54 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 55 | 56 | /* Source Map Options */ 57 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 58 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 59 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 60 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 61 | 62 | /* Experimental Options */ 63 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 64 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 65 | 66 | /* Advanced Options */ 67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 68 | }, 69 | "exclude": [ 70 | "node_modules", 71 | "tests/**/*.spec.ts" 72 | ], 73 | "include": [ 74 | "src/**/*" 75 | ], 76 | } 77 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": {}, 7 | "rules": { 8 | "interface-over-type-literal": false, 9 | "member-ordering": false, 10 | "max-classes-per-file": [true, 15], 11 | "object-literal-sort-keys": false, 12 | "quotemark": [true, "single", "avoid-escape", "avoid-template"], 13 | "variable-name": { 14 | "options": [ 15 | "allow-leading-underscore", 16 | "allow-snake-case" 17 | ] 18 | } 19 | }, 20 | "rulesDirectory": [] 21 | } -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Updating website docs 2 | 3 | # Updating typedoc docs 4 | 5 | 1. `npm run doc:api:build` 6 | 2. check if some new files generated and add them to `sidebar.js` 7 | 3. check if some new modules must be added to `website/docs/api.md` -------------------------------------------------------------------------------- /website/docs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: changelog 3 | title: Changelog 4 | --- 5 | ## 0.0.6 6 | 7 | * Added `withIndex` method to `SearchQuery` - allows to specify index for onlt one query. In the contrast `withIndex` method on `Cluster` will override index for all search queries. 8 | * Deleted `body` and `prettyBody` getters from `SearchQuery` - this is done in order to allow passing compiler version as an argument when multiple elasticsearch versions support will be implemented. 9 | * Added `toPrettyJSON` method to `SearchQuery` - was known as `pretyBody` getter. The reason is same as above. 10 | 11 | ## 0.0.5 12 | Added instance mapper support 13 | 14 | It's possible now to pass a function which map ids from elasticsearch to structure definded by instance mapper function. 15 | 16 | When specifying `source(false)`, elasticsearch returns only _id of found document in `hit._source` field. 17 | 18 | See an example in [docs](instance_mapper.md) 19 | -------------------------------------------------------------------------------- /website/docs/aggregations.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: aggregations 3 | title: Aggregations 4 | --- 5 | 6 | Elasticmagic DSL allows you to define aggregations on any complexity. 7 | 8 | ## How it works 9 | 10 | #### Aggregations 11 | 12 | 13 | ##### Basic API 14 | 15 | To start writing aggregations we can reuse `LaptopDoc` from [Querying](querying.md) page. 16 | 17 | ```javascript 18 | import { 19 | Doc, 20 | Field, 21 | 22 | StringType, 23 | IntegerType, 24 | DateType, 25 | BooleanType, 26 | FloatType, 27 | } from 'elasticmagic'; 28 | 29 | class LaptopDoc extends Doc { 30 | public static docType: string = 'laptop'; 31 | 32 | public static model = new Field(StringType, 'model', Laptop); 33 | public static cpu = new Field(IntegerType, 'cpu', Laptop); 34 | public static price = new Field(FloatType, 'price', Laptop); 35 | public static manufacturerId = new Field(IntegerType, 'manufacturer_id', Laptop); 36 | public static manufacturedAt = new Field(DateType, 'manufactured_at', Laptop); 37 | public static forGames = new Field(BooleanType, 'for_games', Laptop); 38 | 39 | public model?: string; 40 | public cpu?: number; 41 | public price?: number; 42 | public manufactured_id?: number; 43 | public manufactured_at?: string; // ISO format string 44 | public for_games?: boolean; 45 | } 46 | ``` 47 | 48 | `SearchQuery` instance has a `.aggregations()` (with short alias `.aggs()`) method. 49 | 50 | It accepts object where key is a name of aggregation and value can be one of expressions: 51 | 52 | - `agg.Terms` 53 | 54 | 55 | ##### Start wrinting aggregations 56 | 57 | Conventionaly, you can import all aggregation related stuff as: 58 | 59 | TODO - test this code and decide 60 | 61 | ```javascript 62 | import * as aggs from 'elasticmagic/aggs'; 63 | // or 64 | import { aggs } from 'elasticmagic'; 65 | ``` 66 | 67 | Lets add some aggregations. 68 | 69 | Suppose we want to get an aggregated list of prices. 70 | 71 | First we filter docs by `manufacturerIds` list. 72 | 73 | Then we create aggregation on `LaptopDoc.price` field, which means we want to collect (aggregate) prices for that manufacturers laptops. 74 | 75 | Also we are specifying nested aggregation named `forGames` - it represents amount laptops which are suited for gaming. 76 | 77 | ```javascript 78 | 79 | import { 80 | Doc, 81 | Field, 82 | 83 | StringType, 84 | IntegerType, 85 | DateType, 86 | BooleanType, 87 | FloatType, 88 | 89 | Bool, 90 | } from 'elasticmagic'; 91 | 92 | import * as aggs from 'elasticmagic/aggs'; 93 | 94 | const manufacturerIds = [1, 2, 3]; 95 | 96 | const query = new SearchQuery() 97 | .limit(0) 98 | .source(false) 99 | .filter( 100 | LaptopDoc.manufacturedId.in(manufacturerIds) 101 | ) 102 | .aggregations({ 103 | prices: new aggs.Terms({ 104 | field: LaptopDoc.price, 105 | /** 106 | * if actual size of matched docs is unknown at the moment of building the query, 107 | * we can set some big value, such as 10 ** 4 108 | */ 109 | size: 10 ** 4, 110 | aggs: { 111 | forGames: new aggs.Filter({ 112 | filter: LaptopDoc.forGames.eq(true), 113 | }) 114 | } 115 | }) 116 | }); 117 | 118 | const result = await qeury.getResult(); 119 | 120 | const pricesBucket = result.getAggregation('prices'); 121 | 122 | const priceBucket = pricesBucket[0]; 123 | 124 | console.log(priceBucket.key); // prints price 125 | 126 | const forGamesBucket = priceBucket.getAggregation('forGames'); 127 | 128 | console.log(forGamesBucket.docCount); // prints laptops amount suited for gaming 129 | 130 | ``` 131 | 132 | We calling `.limit(0)` to say we do not need elasticsearch to limit our query. 133 | 134 | Also we calling `.source(false)` to say we do not need elasticsearch to include source of docs in response. 135 | 136 | As you can see, its pretty easy and straitforward to write an aggregations. 137 | 138 | -------------------------------------------------------------------------------- /website/docs/api.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: api 3 | title: API Reference 4 | sidebar_label: "Index" 5 | --- 6 | 7 | ### External modules 8 | 9 | * ["agg"](api/modules/_agg_.md) 10 | * ["cluster"](api/modules/_cluster_.md) 11 | * ["compiler"](api/modules/_compiler_.md) 12 | * ["document"](api/modules/_document_.md) 13 | * ["expression"](api/modules/_expression_.md) 14 | * ["index"](api/modules/_index_.md) 15 | * ["result"](api/modules/_result_.md) 16 | * ["search"](api/modules/_search_.md) 17 | * ["types"](api/modules/_types_.md) 18 | * ["util"](api/modules/_util_.md) 19 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.aggexpression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.aggexpression" 3 | title: "AggExpression" 4 | sidebar_label: "AggExpression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [ParamsExpression](_expression_.paramsexpression.md) 10 | 11 | ↳ **AggExpression** 12 | 13 | ↳ [BucketAgg](_agg_.bucketagg.md) 14 | 15 | ## Index 16 | 17 | ### Constructors 18 | 19 | * [constructor](_agg_.aggexpression.md#constructor) 20 | 21 | ### Properties 22 | 23 | * [aggName](_agg_.aggexpression.md#aggname) 24 | * [params](_agg_.aggexpression.md#params) 25 | * [queryKey](_agg_.aggexpression.md#querykey) 26 | * [queryName](_agg_.aggexpression.md#queryname) 27 | * [visitName](_agg_.aggexpression.md#visitname) 28 | 29 | ### Methods 30 | 31 | * [buildAggResult](_agg_.aggexpression.md#buildaggresult) 32 | * [collectDocClasses](_agg_.aggexpression.md#collectdocclasses) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new AggExpression**(`params?`: [Dictionary](../modules/_types_.md#dictionary)‹any, any›): *[AggExpression](_agg_.aggexpression.md)* 39 | 40 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 41 | 42 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 43 | 44 | **Parameters:** 45 | 46 | Name | Type | 47 | ------ | ------ | 48 | `params?` | [Dictionary](../modules/_types_.md#dictionary)‹any, any› | 49 | 50 | **Returns:** *[AggExpression](_agg_.aggexpression.md)* 51 | 52 | ## Properties 53 | 54 | ### aggName 55 | 56 | • **aggName**: *any* 57 | 58 | *Defined in [agg.ts:53](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L53)* 59 | 60 | ___ 61 | 62 | ### params 63 | 64 | • **params**: *[Params](_expression_.params.md)* 65 | 66 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 67 | 68 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 69 | 70 | ___ 71 | 72 | ### queryKey 73 | 74 | • **queryKey**: *string* 75 | 76 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 77 | 78 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 79 | 80 | ___ 81 | 82 | ### queryName 83 | 84 | • **queryName**: *string* 85 | 86 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 87 | 88 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 89 | 90 | ___ 91 | 92 | ### visitName 93 | 94 | • **visitName**: *string* = "agg" 95 | 96 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 97 | 98 | *Defined in [agg.ts:52](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L52)* 99 | 100 | ## Methods 101 | 102 | ### buildAggResult 103 | 104 | ▸ **buildAggResult**(`rawData`: [Dictionary](../modules/_types_.md#dictionary)‹string, any›, `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[AggResult](_agg_.aggresult.md)* 105 | 106 | *Defined in [agg.ts:55](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L55)* 107 | 108 | **Parameters:** 109 | 110 | Name | Type | Default | 111 | ------ | ------ | ------ | 112 | `rawData` | [Dictionary](../modules/_types_.md#dictionary)‹string, any› | - | 113 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 114 | `mapperRegistry` | any | {} | 115 | 116 | **Returns:** *[AggResult](_agg_.aggresult.md)* 117 | 118 | ___ 119 | 120 | ### collectDocClasses 121 | 122 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 123 | 124 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 125 | 126 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 127 | 128 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 129 | 130 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 131 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.aggresult.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.aggresult" 3 | title: "AggResult" 4 | sidebar_label: "AggResult" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **AggResult** 10 | 11 | ↳ [SingleBucketAggResult](_agg_.singlebucketaggresult.md) 12 | 13 | ↳ [MultiBucketAggResult](_agg_.multibucketaggresult.md) 14 | 15 | ## Index 16 | 17 | ### Constructors 18 | 19 | * [constructor](_agg_.aggresult.md#constructor) 20 | 21 | ### Properties 22 | 23 | * [buckets](_agg_.aggresult.md#buckets) 24 | * [docCount](_agg_.aggresult.md#doccount) 25 | * [expr](_agg_.aggresult.md#expr) 26 | 27 | ## Constructors 28 | 29 | ### constructor 30 | 31 | \+ **new AggResult**(`expr`: [BucketAgg](_agg_.bucketagg.md)): *[AggResult](_agg_.aggresult.md)* 32 | 33 | *Defined in [agg.ts:47](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L47)* 34 | 35 | **Parameters:** 36 | 37 | Name | Type | 38 | ------ | ------ | 39 | `expr` | [BucketAgg](_agg_.bucketagg.md) | 40 | 41 | **Returns:** *[AggResult](_agg_.aggresult.md)* 42 | 43 | ## Properties 44 | 45 | ### buckets 46 | 47 | • **buckets**: *[Bucket](_agg_.bucket.md)[]* = [] 48 | 49 | *Defined in [agg.ts:46](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L46)* 50 | 51 | ___ 52 | 53 | ### docCount 54 | 55 | • **docCount**: *number* = 0 56 | 57 | *Defined in [agg.ts:47](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L47)* 58 | 59 | ___ 60 | 61 | ### expr 62 | 63 | • **expr**: *[BucketAgg](_agg_.bucketagg.md)* 64 | 65 | *Defined in [agg.ts:48](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L48)* 66 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.bucket.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.bucket" 3 | title: "Bucket" 4 | sidebar_label: "Bucket" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **Bucket** 10 | 11 | ## Index 12 | 13 | ### Constructors 14 | 15 | * [constructor](_agg_.bucket.md#constructor) 16 | 17 | ### Properties 18 | 19 | * [aggregations](_agg_.bucket.md#aggregations) 20 | * [docCount](_agg_.bucket.md#doccount) 21 | * [key](_agg_.bucket.md#key) 22 | * [parent](_agg_.bucket.md#private-parent) 23 | 24 | ### Methods 25 | 26 | * [getAggregation](_agg_.bucket.md#getaggregation) 27 | * [toString](_agg_.bucket.md#tostring) 28 | 29 | ## Constructors 30 | 31 | ### constructor 32 | 33 | \+ **new Bucket**(`rawData`: [RawAggBucket](../modules/_types_.md#rawaggbucket), `aggExpr`: [BucketAgg](_agg_.bucketagg.md), `parent`: [AggResult](_agg_.aggresult.md), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[Bucket](_agg_.bucket.md)* 34 | 35 | *Defined in [agg.ts:12](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L12)* 36 | 37 | **Parameters:** 38 | 39 | Name | Type | 40 | ------ | ------ | 41 | `rawData` | [RawAggBucket](../modules/_types_.md#rawaggbucket) | 42 | `aggExpr` | [BucketAgg](_agg_.bucketagg.md) | 43 | `parent` | [AggResult](_agg_.aggresult.md) | 44 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | 45 | `mapperRegistry` | any | 46 | 47 | **Returns:** *[Bucket](_agg_.bucket.md)* 48 | 49 | ## Properties 50 | 51 | ### aggregations 52 | 53 | • **aggregations**: *[Dictionary](../modules/_types_.md#dictionary)‹string, [AggResult](_agg_.aggresult.md)›* 54 | 55 | *Defined in [agg.ts:12](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L12)* 56 | 57 | ___ 58 | 59 | ### docCount 60 | 61 | • **docCount**: *number* 62 | 63 | *Defined in [agg.ts:11](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L11)* 64 | 65 | ___ 66 | 67 | ### key 68 | 69 | • **key**: *[BucketKey](../modules/_agg_.md#bucketkey)* 70 | 71 | *Defined in [agg.ts:10](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L10)* 72 | 73 | ___ 74 | 75 | ### `Private` parent 76 | 77 | • **parent**: *[AggResult](_agg_.aggresult.md)* 78 | 79 | *Defined in [agg.ts:17](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L17)* 80 | 81 | ## Methods 82 | 83 | ### getAggregation 84 | 85 | ▸ **getAggregation**(`name`: string): *[AggResult](_agg_.aggresult.md)* 86 | 87 | *Defined in [agg.ts:36](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L36)* 88 | 89 | **Parameters:** 90 | 91 | Name | Type | 92 | ------ | ------ | 93 | `name` | string | 94 | 95 | **Returns:** *[AggResult](_agg_.aggresult.md)* 96 | 97 | ___ 98 | 99 | ### toString 100 | 101 | ▸ **toString**(): *string* 102 | 103 | *Defined in [agg.ts:40](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L40)* 104 | 105 | **Returns:** *string* 106 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.bucketagg.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.bucketagg" 3 | title: "BucketAgg" 4 | sidebar_label: "BucketAgg" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [AggExpression](_agg_.aggexpression.md) 10 | 11 | ↳ **BucketAgg** 12 | 13 | ↳ [SingleBucketAgg](_agg_.singlebucketagg.md) 14 | 15 | ↳ [MultiBucketAgg](_agg_.multibucketagg.md) 16 | 17 | ## Index 18 | 19 | ### Constructors 20 | 21 | * [constructor](_agg_.bucketagg.md#constructor) 22 | 23 | ### Properties 24 | 25 | * [aggName](_agg_.bucketagg.md#aggname) 26 | * [aggregations](_agg_.bucketagg.md#aggregations) 27 | * [params](_agg_.bucketagg.md#params) 28 | * [queryKey](_agg_.bucketagg.md#querykey) 29 | * [queryName](_agg_.bucketagg.md#queryname) 30 | * [visitName](_agg_.bucketagg.md#visitname) 31 | 32 | ### Methods 33 | 34 | * [buildAggResult](_agg_.bucketagg.md#buildaggresult) 35 | * [collectDocClasses](_agg_.bucketagg.md#collectdocclasses) 36 | 37 | ## Constructors 38 | 39 | ### constructor 40 | 41 | \+ **new BucketAgg**(`aggs?`: [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)›, `params?`: [ParamsType](../modules/_expression_.md#paramstype)): *[BucketAgg](_agg_.bucketagg.md)* 42 | 43 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 44 | 45 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 46 | 47 | **Parameters:** 48 | 49 | Name | Type | 50 | ------ | ------ | 51 | `aggs?` | [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)› | 52 | `params?` | [ParamsType](../modules/_expression_.md#paramstype) | 53 | 54 | **Returns:** *[BucketAgg](_agg_.bucketagg.md)* 55 | 56 | ## Properties 57 | 58 | ### aggName 59 | 60 | • **aggName**: *string* 61 | 62 | *Overrides [AggExpression](_agg_.aggexpression.md).[aggName](_agg_.aggexpression.md#aggname)* 63 | 64 | *Defined in [agg.ts:66](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L66)* 65 | 66 | ___ 67 | 68 | ### aggregations 69 | 70 | • **aggregations**: *[Params](_expression_.params.md)* 71 | 72 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 73 | 74 | ___ 75 | 76 | ### params 77 | 78 | • **params**: *[Params](_expression_.params.md)* 79 | 80 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 81 | 82 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 83 | 84 | ___ 85 | 86 | ### queryKey 87 | 88 | • **queryKey**: *string* 89 | 90 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 91 | 92 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 93 | 94 | ___ 95 | 96 | ### queryName 97 | 98 | • **queryName**: *string* 99 | 100 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 101 | 102 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 103 | 104 | ___ 105 | 106 | ### visitName 107 | 108 | • **visitName**: *string* = "bucketAgg" 109 | 110 | *Overrides [AggExpression](_agg_.aggexpression.md).[visitName](_agg_.aggexpression.md#visitname)* 111 | 112 | *Defined in [agg.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L65)* 113 | 114 | ## Methods 115 | 116 | ### buildAggResult 117 | 118 | ▸ **buildAggResult**(`rawData`: [Dictionary](../modules/_types_.md#dictionary)‹string, any›, `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[AggResult](_agg_.aggresult.md)* 119 | 120 | *Inherited from [AggExpression](_agg_.aggexpression.md).[buildAggResult](_agg_.aggexpression.md#buildaggresult)* 121 | 122 | *Defined in [agg.ts:55](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L55)* 123 | 124 | **Parameters:** 125 | 126 | Name | Type | Default | 127 | ------ | ------ | ------ | 128 | `rawData` | [Dictionary](../modules/_types_.md#dictionary)‹string, any› | - | 129 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 130 | `mapperRegistry` | any | {} | 131 | 132 | **Returns:** *[AggResult](_agg_.aggresult.md)* 133 | 134 | ___ 135 | 136 | ### collectDocClasses 137 | 138 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 139 | 140 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 141 | 142 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 143 | 144 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 145 | 146 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 147 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.filter" 3 | title: "Filter" 4 | sidebar_label: "Filter" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [SingleBucketAgg](_agg_.singlebucketagg.md) 10 | 11 | ↳ **Filter** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_agg_.filter.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [aggName](_agg_.filter.md#aggname) 22 | * [aggregations](_agg_.filter.md#aggregations) 23 | * [filter](_agg_.filter.md#filter) 24 | * [params](_agg_.filter.md#params) 25 | * [queryKey](_agg_.filter.md#querykey) 26 | * [queryName](_agg_.filter.md#queryname) 27 | * [visitName](_agg_.filter.md#visitname) 28 | 29 | ### Methods 30 | 31 | * [buildAggResult](_agg_.filter.md#buildaggresult) 32 | * [collectDocClasses](_agg_.filter.md#collectdocclasses) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new Filter**(`__namedParameters`: object): *[Filter](_agg_.filter.md)* 39 | 40 | *Overrides [SingleBucketAgg](_agg_.singlebucketagg.md).[constructor](_agg_.singlebucketagg.md#constructor)* 41 | 42 | *Defined in [agg.ts:267](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L267)* 43 | 44 | **Parameters:** 45 | 46 | ▪ **__namedParameters**: *object* 47 | 48 | Name | Type | 49 | ------ | ------ | 50 | `aggs` | undefined | object | 51 | `filter` | [Expression](_expression_.expression.md)‹› | 52 | `opts` | opts | 53 | 54 | **Returns:** *[Filter](_agg_.filter.md)* 55 | 56 | ## Properties 57 | 58 | ### aggName 59 | 60 | • **aggName**: *string* = "filter" 61 | 62 | *Overrides [SingleBucketAgg](_agg_.singlebucketagg.md).[aggName](_agg_.singlebucketagg.md#aggname)* 63 | 64 | *Defined in [agg.ts:265](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L265)* 65 | 66 | ___ 67 | 68 | ### aggregations 69 | 70 | • **aggregations**: *[Params](_expression_.params.md)* 71 | 72 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[aggregations](_agg_.bucketagg.md#aggregations)* 73 | 74 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 75 | 76 | ___ 77 | 78 | ### filter 79 | 80 | • **filter**: *[Expression](_expression_.expression.md)* 81 | 82 | *Defined in [agg.ts:267](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L267)* 83 | 84 | ___ 85 | 86 | ### params 87 | 88 | • **params**: *[Params](_expression_.params.md)* 89 | 90 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 91 | 92 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 93 | 94 | ___ 95 | 96 | ### queryKey 97 | 98 | • **queryKey**: *string* 99 | 100 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 101 | 102 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 103 | 104 | ___ 105 | 106 | ### queryName 107 | 108 | • **queryName**: *string* 109 | 110 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 111 | 112 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 113 | 114 | ___ 115 | 116 | ### visitName 117 | 118 | • **visitName**: *string* = "filterAgg" 119 | 120 | *Overrides [BucketAgg](_agg_.bucketagg.md).[visitName](_agg_.bucketagg.md#visitname)* 121 | 122 | *Defined in [agg.ts:264](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L264)* 123 | 124 | ## Methods 125 | 126 | ### buildAggResult 127 | 128 | ▸ **buildAggResult**(`rawData`: [RawAggBucket](../modules/_types_.md#rawaggbucket), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 129 | 130 | *Inherited from [SingleBucketAgg](_agg_.singlebucketagg.md).[buildAggResult](_agg_.singlebucketagg.md#buildaggresult)* 131 | 132 | *Overrides [AggExpression](_agg_.aggexpression.md).[buildAggResult](_agg_.aggexpression.md#buildaggresult)* 133 | 134 | *Defined in [agg.ts:191](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L191)* 135 | 136 | **Parameters:** 137 | 138 | Name | Type | Default | 139 | ------ | ------ | ------ | 140 | `rawData` | [RawAggBucket](../modules/_types_.md#rawaggbucket) | - | 141 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 142 | `mapperRegistry` | any | null | 143 | 144 | **Returns:** *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 145 | 146 | ___ 147 | 148 | ### collectDocClasses 149 | 150 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 151 | 152 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 153 | 154 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 155 | 156 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 157 | 158 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 159 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.multibucketagg.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.multibucketagg" 3 | title: "MultiBucketAgg" 4 | sidebar_label: "MultiBucketAgg" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [BucketAgg](_agg_.bucketagg.md) 10 | 11 | ↳ **MultiBucketAgg** 12 | 13 | ↳ [Terms](_agg_.terms.md) 14 | 15 | ## Index 16 | 17 | ### Constructors 18 | 19 | * [constructor](_agg_.multibucketagg.md#constructor) 20 | 21 | ### Properties 22 | 23 | * [aggName](_agg_.multibucketagg.md#aggname) 24 | * [aggregations](_agg_.multibucketagg.md#aggregations) 25 | * [instanceMapper](_agg_.multibucketagg.md#protected-optional-instancemapper) 26 | * [params](_agg_.multibucketagg.md#params) 27 | * [queryKey](_agg_.multibucketagg.md#querykey) 28 | * [queryName](_agg_.multibucketagg.md#queryname) 29 | * [type](_agg_.multibucketagg.md#private-optional-type) 30 | * [visitName](_agg_.multibucketagg.md#visitname) 31 | 32 | ### Methods 33 | 34 | * [buildAggResult](_agg_.multibucketagg.md#buildaggresult) 35 | * [collectDocClasses](_agg_.multibucketagg.md#collectdocclasses) 36 | 37 | ## Constructors 38 | 39 | ### constructor 40 | 41 | \+ **new MultiBucketAgg**(`aggs?`: [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)›, `params?`: [TermsOptionsShrink](../modules/_agg_.md#termsoptionsshrink), `type?`: [FieldType](_document_.fieldtype.md), `instanceMapper?`: [InstanceMapper](../modules/_search_.md#instancemapper)‹any›): *[MultiBucketAgg](_agg_.multibucketagg.md)* 42 | 43 | *Overrides [BucketAgg](_agg_.bucketagg.md).[constructor](_agg_.bucketagg.md#constructor)* 44 | 45 | *Defined in [agg.ts:201](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L201)* 46 | 47 | **Parameters:** 48 | 49 | Name | Type | 50 | ------ | ------ | 51 | `aggs?` | [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)› | 52 | `params?` | [TermsOptionsShrink](../modules/_agg_.md#termsoptionsshrink) | 53 | `type?` | [FieldType](_document_.fieldtype.md) | 54 | `instanceMapper?` | [InstanceMapper](../modules/_search_.md#instancemapper)‹any› | 55 | 56 | **Returns:** *[MultiBucketAgg](_agg_.multibucketagg.md)* 57 | 58 | ## Properties 59 | 60 | ### aggName 61 | 62 | • **aggName**: *any* 63 | 64 | *Overrides [BucketAgg](_agg_.bucketagg.md).[aggName](_agg_.bucketagg.md#aggname)* 65 | 66 | *Defined in [agg.ts:201](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L201)* 67 | 68 | ___ 69 | 70 | ### aggregations 71 | 72 | • **aggregations**: *[Params](_expression_.params.md)* 73 | 74 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[aggregations](_agg_.bucketagg.md#aggregations)* 75 | 76 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 77 | 78 | ___ 79 | 80 | ### `Protected` `Optional` instanceMapper 81 | 82 | • **instanceMapper**? : *[InstanceMapper](../modules/_search_.md#instancemapper)‹any›* 83 | 84 | *Defined in [agg.ts:210](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L210)* 85 | 86 | ___ 87 | 88 | ### params 89 | 90 | • **params**: *[Params](_expression_.params.md)* 91 | 92 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 93 | 94 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 95 | 96 | ___ 97 | 98 | ### queryKey 99 | 100 | • **queryKey**: *string* 101 | 102 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 103 | 104 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 105 | 106 | ___ 107 | 108 | ### queryName 109 | 110 | • **queryName**: *string* 111 | 112 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 113 | 114 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 115 | 116 | ___ 117 | 118 | ### `Private` `Optional` type 119 | 120 | • **type**? : *[FieldType](_document_.fieldtype.md)* 121 | 122 | *Defined in [agg.ts:209](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L209)* 123 | 124 | ___ 125 | 126 | ### visitName 127 | 128 | • **visitName**: *string* = "bucketAgg" 129 | 130 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[visitName](_agg_.bucketagg.md#visitname)* 131 | 132 | *Overrides [AggExpression](_agg_.aggexpression.md).[visitName](_agg_.aggexpression.md#visitname)* 133 | 134 | *Defined in [agg.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L65)* 135 | 136 | ## Methods 137 | 138 | ### buildAggResult 139 | 140 | ▸ **buildAggResult**(`rawData`: [RawAgg](../modules/_types_.md#rawagg), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 141 | 142 | *Overrides [AggExpression](_agg_.aggexpression.md).[buildAggResult](_agg_.aggexpression.md#buildaggresult)* 143 | 144 | *Defined in [agg.ts:215](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L215)* 145 | 146 | **Parameters:** 147 | 148 | Name | Type | Default | 149 | ------ | ------ | ------ | 150 | `rawData` | [RawAgg](../modules/_types_.md#rawagg) | - | 151 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 152 | `mapperRegistry` | any | null | 153 | 154 | **Returns:** *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 155 | 156 | ___ 157 | 158 | ### collectDocClasses 159 | 160 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 161 | 162 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 163 | 164 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 165 | 166 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 167 | 168 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 169 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.multibucketaggresult.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.multibucketaggresult" 3 | title: "MultiBucketAggResult" 4 | sidebar_label: "MultiBucketAggResult" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [AggResult](_agg_.aggresult.md) 10 | 11 | ↳ **MultiBucketAggResult** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_agg_.multibucketaggresult.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [bucketClass](_agg_.multibucketaggresult.md#private-bucketclass) 22 | * [buckets](_agg_.multibucketaggresult.md#buckets) 23 | * [bucketsMap](_agg_.multibucketaggresult.md#private-bucketsmap) 24 | * [docCount](_agg_.multibucketaggresult.md#doccount) 25 | * [expr](_agg_.multibucketaggresult.md#expr) 26 | * [instanceMapper](_agg_.multibucketaggresult.md#private-optional-instancemapper) 27 | * [mapperRegistry](_agg_.multibucketaggresult.md#private-mapperregistry) 28 | 29 | ### Methods 30 | 31 | * [addBucket](_agg_.multibucketaggresult.md#addbucket) 32 | * [getBucket](_agg_.multibucketaggresult.md#getbucket) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new MultiBucketAggResult**(`aggExpr`: [MultiBucketAgg](_agg_.multibucketagg.md), `rawData`: [RawAgg](../modules/_types_.md#rawagg), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any, `instanceMapper?`: [InstanceMapper](../modules/_search_.md#instancemapper)‹any›): *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 39 | 40 | *Overrides [AggResult](_agg_.aggresult.md).[constructor](_agg_.aggresult.md#constructor)* 41 | 42 | *Defined in [agg.ts:121](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L121)* 43 | 44 | **Parameters:** 45 | 46 | Name | Type | 47 | ------ | ------ | 48 | `aggExpr` | [MultiBucketAgg](_agg_.multibucketagg.md) | 49 | `rawData` | [RawAgg](../modules/_types_.md#rawagg) | 50 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | 51 | `mapperRegistry` | any | 52 | `instanceMapper?` | [InstanceMapper](../modules/_search_.md#instancemapper)‹any› | 53 | 54 | **Returns:** *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 55 | 56 | ## Properties 57 | 58 | ### `Private` bucketClass 59 | 60 | • **bucketClass**: *[Bucket](_agg_.bucket.md)* = Bucket 61 | 62 | *Defined in [agg.ts:118](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L118)* 63 | 64 | ___ 65 | 66 | ### buckets 67 | 68 | • **buckets**: *[Bucket](_agg_.bucket.md)[]* = [] 69 | 70 | *Overrides [AggResult](_agg_.aggresult.md).[buckets](_agg_.aggresult.md#buckets)* 71 | 72 | *Defined in [agg.ts:119](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L119)* 73 | 74 | ___ 75 | 76 | ### `Private` bucketsMap 77 | 78 | • **bucketsMap**: *[Dictionary](../modules/_types_.md#dictionary)‹string, [Bucket](_agg_.bucket.md)›* 79 | 80 | *Defined in [agg.ts:120](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L120)* 81 | 82 | ___ 83 | 84 | ### docCount 85 | 86 | • **docCount**: *number* = 0 87 | 88 | *Inherited from [AggResult](_agg_.aggresult.md).[docCount](_agg_.aggresult.md#doccount)* 89 | 90 | *Defined in [agg.ts:47](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L47)* 91 | 92 | ___ 93 | 94 | ### expr 95 | 96 | • **expr**: *[BucketAgg](_agg_.bucketagg.md)* 97 | 98 | *Inherited from [AggResult](_agg_.aggresult.md).[expr](_agg_.aggresult.md#expr)* 99 | 100 | *Defined in [agg.ts:48](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L48)* 101 | 102 | ___ 103 | 104 | ### `Private` `Optional` instanceMapper 105 | 106 | • **instanceMapper**? : *[InstanceMapper](../modules/_search_.md#instancemapper)‹any›* 107 | 108 | *Defined in [agg.ts:128](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L128)* 109 | 110 | ___ 111 | 112 | ### `Private` mapperRegistry 113 | 114 | • **mapperRegistry**: *any* 115 | 116 | *Defined in [agg.ts:121](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L121)* 117 | 118 | ## Methods 119 | 120 | ### addBucket 121 | 122 | ▸ **addBucket**(`bucket`: [Bucket](_agg_.bucket.md)): *void* 123 | 124 | *Defined in [agg.ts:167](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L167)* 125 | 126 | **Parameters:** 127 | 128 | Name | Type | 129 | ------ | ------ | 130 | `bucket` | [Bucket](_agg_.bucket.md) | 131 | 132 | **Returns:** *void* 133 | 134 | ___ 135 | 136 | ### getBucket 137 | 138 | ▸ **getBucket**(`key`: [BucketKey](../modules/_agg_.md#bucketkey)): *[Bucket](_agg_.bucket.md)‹›* 139 | 140 | *Defined in [agg.ts:174](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L174)* 141 | 142 | **Parameters:** 143 | 144 | Name | Type | 145 | ------ | ------ | 146 | `key` | [BucketKey](../modules/_agg_.md#bucketkey) | 147 | 148 | **Returns:** *[Bucket](_agg_.bucket.md)‹›* 149 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.singlebucketagg.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.singlebucketagg" 3 | title: "SingleBucketAgg" 4 | sidebar_label: "SingleBucketAgg" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [BucketAgg](_agg_.bucketagg.md) 10 | 11 | ↳ **SingleBucketAgg** 12 | 13 | ↳ [Filter](_agg_.filter.md) 14 | 15 | ## Index 16 | 17 | ### Constructors 18 | 19 | * [constructor](_agg_.singlebucketagg.md#constructor) 20 | 21 | ### Properties 22 | 23 | * [aggName](_agg_.singlebucketagg.md#aggname) 24 | * [aggregations](_agg_.singlebucketagg.md#aggregations) 25 | * [params](_agg_.singlebucketagg.md#params) 26 | * [queryKey](_agg_.singlebucketagg.md#querykey) 27 | * [queryName](_agg_.singlebucketagg.md#queryname) 28 | * [visitName](_agg_.singlebucketagg.md#visitname) 29 | 30 | ### Methods 31 | 32 | * [buildAggResult](_agg_.singlebucketagg.md#buildaggresult) 33 | * [collectDocClasses](_agg_.singlebucketagg.md#collectdocclasses) 34 | 35 | ## Constructors 36 | 37 | ### constructor 38 | 39 | \+ **new SingleBucketAgg**(`aggs?`: [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)›, `params?`: [Dictionary](../modules/_types_.md#dictionary)‹string, any›): *[SingleBucketAgg](_agg_.singlebucketagg.md)* 40 | 41 | *Overrides [BucketAgg](_agg_.bucketagg.md).[constructor](_agg_.bucketagg.md#constructor)* 42 | 43 | *Defined in [agg.ts:180](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L180)* 44 | 45 | **Parameters:** 46 | 47 | Name | Type | 48 | ------ | ------ | 49 | `aggs?` | [Dictionary](../modules/_types_.md#dictionary)‹string, [Filter](_agg_.filter.md)› | 50 | `params?` | [Dictionary](../modules/_types_.md#dictionary)‹string, any› | 51 | 52 | **Returns:** *[SingleBucketAgg](_agg_.singlebucketagg.md)* 53 | 54 | ## Properties 55 | 56 | ### aggName 57 | 58 | • **aggName**: *string* 59 | 60 | *Overrides [BucketAgg](_agg_.bucketagg.md).[aggName](_agg_.bucketagg.md#aggname)* 61 | 62 | *Defined in [agg.ts:180](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L180)* 63 | 64 | ___ 65 | 66 | ### aggregations 67 | 68 | • **aggregations**: *[Params](_expression_.params.md)* 69 | 70 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[aggregations](_agg_.bucketagg.md#aggregations)* 71 | 72 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 73 | 74 | ___ 75 | 76 | ### params 77 | 78 | • **params**: *[Params](_expression_.params.md)* 79 | 80 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 81 | 82 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 83 | 84 | ___ 85 | 86 | ### queryKey 87 | 88 | • **queryKey**: *string* 89 | 90 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 91 | 92 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 93 | 94 | ___ 95 | 96 | ### queryName 97 | 98 | • **queryName**: *string* 99 | 100 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 101 | 102 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 103 | 104 | ___ 105 | 106 | ### visitName 107 | 108 | • **visitName**: *string* = "bucketAgg" 109 | 110 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[visitName](_agg_.bucketagg.md#visitname)* 111 | 112 | *Overrides [AggExpression](_agg_.aggexpression.md).[visitName](_agg_.aggexpression.md#visitname)* 113 | 114 | *Defined in [agg.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L65)* 115 | 116 | ## Methods 117 | 118 | ### buildAggResult 119 | 120 | ▸ **buildAggResult**(`rawData`: [RawAggBucket](../modules/_types_.md#rawaggbucket), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 121 | 122 | *Overrides [AggExpression](_agg_.aggexpression.md).[buildAggResult](_agg_.aggexpression.md#buildaggresult)* 123 | 124 | *Defined in [agg.ts:191](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L191)* 125 | 126 | **Parameters:** 127 | 128 | Name | Type | Default | 129 | ------ | ------ | ------ | 130 | `rawData` | [RawAggBucket](../modules/_types_.md#rawaggbucket) | - | 131 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 132 | `mapperRegistry` | any | null | 133 | 134 | **Returns:** *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 135 | 136 | ___ 137 | 138 | ### collectDocClasses 139 | 140 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 141 | 142 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 143 | 144 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 145 | 146 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 147 | 148 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 149 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.singlebucketaggresult.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.singlebucketaggresult" 3 | title: "SingleBucketAggResult" 4 | sidebar_label: "SingleBucketAggResult" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [AggResult](_agg_.aggresult.md) 10 | 11 | ↳ **SingleBucketAggResult** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_agg_.singlebucketaggresult.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [aggregations](_agg_.singlebucketaggresult.md#aggregations) 22 | * [buckets](_agg_.singlebucketaggresult.md#buckets) 23 | * [docCount](_agg_.singlebucketaggresult.md#doccount) 24 | * [expr](_agg_.singlebucketaggresult.md#expr) 25 | 26 | ### Methods 27 | 28 | * [getAggregation](_agg_.singlebucketaggresult.md#getaggregation) 29 | 30 | ## Constructors 31 | 32 | ### constructor 33 | 34 | \+ **new SingleBucketAggResult**(`aggExpr`: [SingleBucketAgg](_agg_.singlebucketagg.md), `rawData`: [RawAggBucket](../modules/_types_.md#rawaggbucket), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 35 | 36 | *Overrides [AggResult](_agg_.aggresult.md).[constructor](_agg_.aggresult.md#constructor)* 37 | 38 | *Defined in [agg.ts:89](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L89)* 39 | 40 | **Parameters:** 41 | 42 | Name | Type | 43 | ------ | ------ | 44 | `aggExpr` | [SingleBucketAgg](_agg_.singlebucketagg.md) | 45 | `rawData` | [RawAggBucket](../modules/_types_.md#rawaggbucket) | 46 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | 47 | `mapperRegistry` | any | 48 | 49 | **Returns:** *[SingleBucketAggResult](_agg_.singlebucketaggresult.md)* 50 | 51 | ## Properties 52 | 53 | ### aggregations 54 | 55 | • **aggregations**: *[Dictionary](../modules/_types_.md#dictionary)‹string, [AggResult](_agg_.aggresult.md)›* 56 | 57 | *Defined in [agg.ts:89](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L89)* 58 | 59 | ___ 60 | 61 | ### buckets 62 | 63 | • **buckets**: *[Bucket](_agg_.bucket.md)[]* = [] 64 | 65 | *Inherited from [AggResult](_agg_.aggresult.md).[buckets](_agg_.aggresult.md#buckets)* 66 | 67 | *Defined in [agg.ts:46](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L46)* 68 | 69 | ___ 70 | 71 | ### docCount 72 | 73 | • **docCount**: *number* = 0 74 | 75 | *Overrides [AggResult](_agg_.aggresult.md).[docCount](_agg_.aggresult.md#doccount)* 76 | 77 | *Defined in [agg.ts:88](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L88)* 78 | 79 | ___ 80 | 81 | ### expr 82 | 83 | • **expr**: *[BucketAgg](_agg_.bucketagg.md)* 84 | 85 | *Inherited from [AggResult](_agg_.aggresult.md).[expr](_agg_.aggresult.md#expr)* 86 | 87 | *Defined in [agg.ts:48](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L48)* 88 | 89 | ## Methods 90 | 91 | ### getAggregation 92 | 93 | ▸ **getAggregation**(`name`: string): *[AggResult](_agg_.aggresult.md)* 94 | 95 | *Defined in [agg.ts:112](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L112)* 96 | 97 | **Parameters:** 98 | 99 | Name | Type | 100 | ------ | ------ | 101 | `name` | string | 102 | 103 | **Returns:** *[AggResult](_agg_.aggresult.md)* 104 | -------------------------------------------------------------------------------- /website/docs/api/classes/_agg_.terms.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_.terms" 3 | title: "Terms" 4 | sidebar_label: "Terms" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [MultiBucketAgg](_agg_.multibucketagg.md) 10 | 11 | ↳ **Terms** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_agg_.terms.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [aggName](_agg_.terms.md#aggname) 22 | * [aggregations](_agg_.terms.md#aggregations) 23 | * [instanceMapper](_agg_.terms.md#protected-optional-instancemapper) 24 | * [params](_agg_.terms.md#params) 25 | * [queryKey](_agg_.terms.md#querykey) 26 | * [queryName](_agg_.terms.md#queryname) 27 | * [visitName](_agg_.terms.md#visitname) 28 | 29 | ### Methods 30 | 31 | * [buildAggResult](_agg_.terms.md#buildaggresult) 32 | * [collectDocClasses](_agg_.terms.md#collectdocclasses) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new Terms**(`__namedParameters`: object): *[Terms](_agg_.terms.md)* 39 | 40 | *Overrides [MultiBucketAgg](_agg_.multibucketagg.md).[constructor](_agg_.multibucketagg.md#constructor)* 41 | 42 | *Defined in [agg.ts:244](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L244)* 43 | 44 | **Parameters:** 45 | 46 | ▪ **__namedParameters**: *object* 47 | 48 | Name | Type | 49 | ------ | ------ | 50 | `aggs` | undefined | object | 51 | `field` | [Field](_document_.field.md)‹› | 52 | `instanceMapper` | undefined | function | 53 | `opts` | opts | 54 | `type` | undefined | [FieldType](_document_.fieldtype.md)‹› | 55 | 56 | **Returns:** *[Terms](_agg_.terms.md)* 57 | 58 | ## Properties 59 | 60 | ### aggName 61 | 62 | • **aggName**: *string* = "terms" 63 | 64 | *Overrides [MultiBucketAgg](_agg_.multibucketagg.md).[aggName](_agg_.multibucketagg.md#aggname)* 65 | 66 | *Defined in [agg.ts:244](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L244)* 67 | 68 | ___ 69 | 70 | ### aggregations 71 | 72 | • **aggregations**: *[Params](_expression_.params.md)* 73 | 74 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[aggregations](_agg_.bucketagg.md#aggregations)* 75 | 76 | *Defined in [agg.ts:68](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L68)* 77 | 78 | ___ 79 | 80 | ### `Protected` `Optional` instanceMapper 81 | 82 | • **instanceMapper**? : *[InstanceMapper](../modules/_search_.md#instancemapper)‹any›* 83 | 84 | *Inherited from [MultiBucketAgg](_agg_.multibucketagg.md).[instanceMapper](_agg_.multibucketagg.md#protected-optional-instancemapper)* 85 | 86 | *Defined in [agg.ts:210](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L210)* 87 | 88 | ___ 89 | 90 | ### params 91 | 92 | • **params**: *[Params](_expression_.params.md)* 93 | 94 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 95 | 96 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 97 | 98 | ___ 99 | 100 | ### queryKey 101 | 102 | • **queryKey**: *string* 103 | 104 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 105 | 106 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 107 | 108 | ___ 109 | 110 | ### queryName 111 | 112 | • **queryName**: *string* 113 | 114 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 115 | 116 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 117 | 118 | ___ 119 | 120 | ### visitName 121 | 122 | • **visitName**: *string* = "bucketAgg" 123 | 124 | *Inherited from [BucketAgg](_agg_.bucketagg.md).[visitName](_agg_.bucketagg.md#visitname)* 125 | 126 | *Overrides [AggExpression](_agg_.aggexpression.md).[visitName](_agg_.aggexpression.md#visitname)* 127 | 128 | *Defined in [agg.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L65)* 129 | 130 | ## Methods 131 | 132 | ### buildAggResult 133 | 134 | ▸ **buildAggResult**(`rawData`: [RawAgg](../modules/_types_.md#rawagg), `docClsMap`: [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)›, `mapperRegistry`: any): *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 135 | 136 | *Inherited from [MultiBucketAgg](_agg_.multibucketagg.md).[buildAggResult](_agg_.multibucketagg.md#buildaggresult)* 137 | 138 | *Overrides [AggExpression](_agg_.aggexpression.md).[buildAggResult](_agg_.aggexpression.md#buildaggresult)* 139 | 140 | *Defined in [agg.ts:215](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L215)* 141 | 142 | **Parameters:** 143 | 144 | Name | Type | Default | 145 | ------ | ------ | ------ | 146 | `rawData` | [RawAgg](../modules/_types_.md#rawagg) | - | 147 | `docClsMap` | [Dictionary](../modules/_types_.md#dictionary)‹string, [DocClass](../modules/_document_.md#docclass)› | {} | 148 | `mapperRegistry` | any | null | 149 | 150 | **Returns:** *[MultiBucketAggResult](_agg_.multibucketaggresult.md)* 151 | 152 | ___ 153 | 154 | ### collectDocClasses 155 | 156 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 157 | 158 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 159 | 160 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 161 | 162 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 163 | 164 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 165 | -------------------------------------------------------------------------------- /website/docs/api/classes/_cluster_.esversion.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_cluster_.esversion" 3 | title: "EsVersion" 4 | sidebar_label: "EsVersion" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **EsVersion** 10 | 11 | ## Index 12 | 13 | ### Constructors 14 | 15 | * [constructor](_cluster_.esversion.md#constructor) 16 | 17 | ### Properties 18 | 19 | * [major](_cluster_.esversion.md#major) 20 | * [minor](_cluster_.esversion.md#minor) 21 | * [patch](_cluster_.esversion.md#patch) 22 | 23 | ## Constructors 24 | 25 | ### constructor 26 | 27 | \+ **new EsVersion**(`major`: number, `minor`: number, `patch`: number): *[EsVersion](_cluster_.esversion.md)* 28 | 29 | *Defined in [cluster.ts:36](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L36)* 30 | 31 | **Parameters:** 32 | 33 | Name | Type | 34 | ------ | ------ | 35 | `major` | number | 36 | `minor` | number | 37 | `patch` | number | 38 | 39 | **Returns:** *[EsVersion](_cluster_.esversion.md)* 40 | 41 | ## Properties 42 | 43 | ### major 44 | 45 | • **major**: *number* 46 | 47 | *Defined in [cluster.ts:37](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L37)* 48 | 49 | ___ 50 | 51 | ### minor 52 | 53 | • **minor**: *number* 54 | 55 | *Defined in [cluster.ts:37](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L37)* 56 | 57 | ___ 58 | 59 | ### patch 60 | 61 | • **patch**: *number* 62 | 63 | *Defined in [cluster.ts:37](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L37)* 64 | -------------------------------------------------------------------------------- /website/docs/api/classes/_cluster_.index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_cluster_.index" 3 | title: "Index" 4 | sidebar_label: "Index" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **Index** 10 | 11 | ## Index 12 | 13 | ### Constructors 14 | 15 | * [constructor](_cluster_.index.md#constructor) 16 | 17 | ### Properties 18 | 19 | * [cluster](_cluster_.index.md#private-cluster) 20 | * [name](_cluster_.index.md#private-name) 21 | 22 | ### Methods 23 | 24 | * [getCluster](_cluster_.index.md#getcluster) 25 | * [getName](_cluster_.index.md#getname) 26 | * [searchQuery](_cluster_.index.md#searchquery) 27 | 28 | ## Constructors 29 | 30 | ### constructor 31 | 32 | \+ **new Index**(`name`: string, `cluster`: [Cluster](_cluster_.cluster.md)): *[Index](_cluster_.index.md)* 33 | 34 | *Defined in [cluster.ts:17](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L17)* 35 | 36 | **Parameters:** 37 | 38 | Name | Type | 39 | ------ | ------ | 40 | `name` | string | 41 | `cluster` | [Cluster](_cluster_.cluster.md) | 42 | 43 | **Returns:** *[Index](_cluster_.index.md)* 44 | 45 | ## Properties 46 | 47 | ### `Private` cluster 48 | 49 | • **cluster**: *[Cluster](_cluster_.cluster.md)* 50 | 51 | *Defined in [cluster.ts:20](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L20)* 52 | 53 | ___ 54 | 55 | ### `Private` name 56 | 57 | • **name**: *string* 58 | 59 | *Defined in [cluster.ts:19](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L19)* 60 | 61 | ## Methods 62 | 63 | ### getCluster 64 | 65 | ▸ **getCluster**(): *[Cluster](_cluster_.cluster.md)* 66 | 67 | *Defined in [cluster.ts:31](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L31)* 68 | 69 | **Returns:** *[Cluster](_cluster_.cluster.md)* 70 | 71 | ___ 72 | 73 | ### getName 74 | 75 | ▸ **getName**(): *string* 76 | 77 | *Defined in [cluster.ts:27](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L27)* 78 | 79 | **Returns:** *string* 80 | 81 | ___ 82 | 83 | ### searchQuery 84 | 85 | ▸ **searchQuery**(`searchQueryOptions`: [SearchQueryOptions](../modules/_search_.md#searchqueryoptions)): *[SearchQuery](_search_.searchquery.md)* 86 | 87 | *Defined in [cluster.ts:23](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L23)* 88 | 89 | **Parameters:** 90 | 91 | Name | Type | 92 | ------ | ------ | 93 | `searchQueryOptions` | [SearchQueryOptions](../modules/_search_.md#searchqueryoptions) | 94 | 95 | **Returns:** *[SearchQuery](_search_.searchquery.md)* 96 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.booleantype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.booleantype" 3 | title: "BooleanType" 4 | sidebar_label: "BooleanType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [FieldType](_document_.fieldtype.md) 10 | 11 | ↳ **BooleanType** 12 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.datetype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.datetype" 3 | title: "DateType" 4 | sidebar_label: "DateType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [FieldType](_document_.fieldtype.md) 10 | 11 | ↳ **DateType** 12 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.doc.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.doc" 3 | title: "Doc" 4 | sidebar_label: "Doc" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **Doc** 10 | 11 | ## Index 12 | 13 | ### Constructors 14 | 15 | * [constructor](_document_.doc.md#constructor) 16 | 17 | ### Properties 18 | 19 | * [_id](_document_.doc.md#_id) 20 | * [docType](_document_.doc.md#doctype) 21 | * [hit](_document_.doc.md#protected-hit) 22 | * [instance](_document_.doc.md#instance) 23 | * [result](_document_.doc.md#protected-result) 24 | * [docType](_document_.doc.md#static-doctype) 25 | 26 | ### Methods 27 | 28 | * [getInstance](_document_.doc.md#getinstance) 29 | * [populateFromSource](_document_.doc.md#private-populatefromsource) 30 | * [setInstance](_document_.doc.md#setinstance) 31 | * [getDocCls](_document_.doc.md#static-getdoccls) 32 | 33 | ## Constructors 34 | 35 | ### constructor 36 | 37 | \+ **new Doc**(`opts`: [DocOpts](../modules/_document_.md#docopts)): *[Doc](_document_.doc.md)* 38 | 39 | *Defined in [document.ts:102](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L102)* 40 | 41 | **Parameters:** 42 | 43 | Name | Type | 44 | ------ | ------ | 45 | `opts` | [DocOpts](../modules/_document_.md#docopts) | 46 | 47 | **Returns:** *[Doc](_document_.doc.md)* 48 | 49 | ## Properties 50 | 51 | ### _id 52 | 53 | • **_id**: *string* 54 | 55 | *Defined in [document.ts:102](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L102)* 56 | 57 | ___ 58 | 59 | ### docType 60 | 61 | • **docType**: *string* 62 | 63 | *Defined in [document.ts:97](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L97)* 64 | 65 | ___ 66 | 67 | ### `Protected` hit 68 | 69 | • **hit**: *[Hit](../modules/_types_.md#hit)* 70 | 71 | *Defined in [document.ts:98](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L98)* 72 | 73 | ___ 74 | 75 | ### instance 76 | 77 | • **instance**: *any* 78 | 79 | *Defined in [document.ts:100](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L100)* 80 | 81 | ___ 82 | 83 | ### `Protected` result 84 | 85 | • **result**: *[SearchResult](_result_.searchresult.md)‹any›* 86 | 87 | *Defined in [document.ts:99](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L99)* 88 | 89 | ___ 90 | 91 | ### `Static` docType 92 | 93 | ▪ **docType**: *string* 94 | 95 | *Defined in [document.ts:96](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L96)* 96 | 97 | ## Methods 98 | 99 | ### getInstance 100 | 101 | ▸ **getInstance**(): *Promise‹any›* 102 | 103 | *Defined in [document.ts:122](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L122)* 104 | 105 | Get instance populated by instance mapper. 106 | 107 | **Returns:** *Promise‹any›* 108 | 109 | ___ 110 | 111 | ### `Private` populateFromSource 112 | 113 | ▸ **populateFromSource**(): *void* 114 | 115 | *Defined in [document.ts:136](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L136)* 116 | 117 | **Returns:** *void* 118 | 119 | ___ 120 | 121 | ### setInstance 122 | 123 | ▸ **setInstance**(`instance`: any): *void* 124 | 125 | *Defined in [document.ts:132](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L132)* 126 | 127 | **Parameters:** 128 | 129 | Name | Type | 130 | ------ | ------ | 131 | `instance` | any | 132 | 133 | **Returns:** *void* 134 | 135 | ___ 136 | 137 | ### `Static` getDocCls 138 | 139 | ▸ **getDocCls**(): *string* 140 | 141 | *Defined in [document.ts:115](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L115)* 142 | 143 | **Returns:** *string* 144 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.fieldtype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.fieldtype" 3 | title: "FieldType" 4 | sidebar_label: "FieldType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **FieldType** 10 | 11 | ↳ [IntegerType](_document_.integertype.md) 12 | 13 | ↳ [BooleanType](_document_.booleantype.md) 14 | 15 | ↳ [DateType](_document_.datetype.md) 16 | 17 | ↳ [FloatType](_document_.floattype.md) 18 | 19 | ↳ [StringType](_document_.stringtype.md) 20 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.floattype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.floattype" 3 | title: "FloatType" 4 | sidebar_label: "FloatType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [FieldType](_document_.fieldtype.md) 10 | 11 | ↳ **FloatType** 12 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.integertype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.integertype" 3 | title: "IntegerType" 4 | sidebar_label: "IntegerType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [FieldType](_document_.fieldtype.md) 10 | 11 | ↳ **IntegerType** 12 | -------------------------------------------------------------------------------- /website/docs/api/classes/_document_.stringtype.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_.stringtype" 3 | title: "StringType" 4 | sidebar_label: "StringType" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [FieldType](_document_.fieldtype.md) 10 | 11 | ↳ **StringType** 12 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.bool.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.bool" 3 | title: "Bool" 4 | sidebar_label: "Bool" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [QueryExpression](_expression_.queryexpression.md) 10 | 11 | ↳ **Bool** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.bool.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [params](_expression_.bool.md#params) 22 | * [queryKey](_expression_.bool.md#querykey) 23 | * [queryName](_expression_.bool.md#queryname) 24 | * [visitName](_expression_.bool.md#visitname) 25 | 26 | ### Methods 27 | 28 | * [collectDocClasses](_expression_.bool.md#collectdocclasses) 29 | * [must](_expression_.bool.md#static-must) 30 | * [mustNot](_expression_.bool.md#static-mustnot) 31 | * [should](_expression_.bool.md#static-should) 32 | 33 | ## Constructors 34 | 35 | ### constructor 36 | 37 | \+ **new Bool**(`options`: [BoolOptions](../modules/_expression_.md#booloptions)): *[Bool](_expression_.bool.md)* 38 | 39 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 40 | 41 | *Defined in [expression.ts:211](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L211)* 42 | 43 | **Parameters:** 44 | 45 | Name | Type | 46 | ------ | ------ | 47 | `options` | [BoolOptions](../modules/_expression_.md#booloptions) | 48 | 49 | **Returns:** *[Bool](_expression_.bool.md)* 50 | 51 | ## Properties 52 | 53 | ### params 54 | 55 | • **params**: *[Params](_expression_.params.md)* 56 | 57 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 58 | 59 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 60 | 61 | ___ 62 | 63 | ### queryKey 64 | 65 | • **queryKey**: *string* 66 | 67 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 68 | 69 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 70 | 71 | ___ 72 | 73 | ### queryName 74 | 75 | • **queryName**: *string* = "bool" 76 | 77 | *Overrides [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 78 | 79 | *Defined in [expression.ts:211](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L211)* 80 | 81 | ___ 82 | 83 | ### visitName 84 | 85 | • **visitName**: *string* = "queryExpression" 86 | 87 | *Inherited from [QueryExpression](_expression_.queryexpression.md).[visitName](_expression_.queryexpression.md#visitname)* 88 | 89 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 90 | 91 | *Defined in [expression.ts:99](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L99)* 92 | 93 | ## Methods 94 | 95 | ### collectDocClasses 96 | 97 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 98 | 99 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 100 | 101 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 102 | 103 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 104 | 105 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 106 | 107 | ___ 108 | 109 | ### `Static` must 110 | 111 | ▸ **must**(...`expressions`: [Expression](_expression_.expression.md)[]): *[Expression](_expression_.expression.md)* 112 | 113 | *Defined in [expression.ts:217](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L217)* 114 | 115 | **Parameters:** 116 | 117 | Name | Type | 118 | ------ | ------ | 119 | `...expressions` | [Expression](_expression_.expression.md)[] | 120 | 121 | **Returns:** *[Expression](_expression_.expression.md)* 122 | 123 | ___ 124 | 125 | ### `Static` mustNot 126 | 127 | ▸ **mustNot**(...`expressions`: [Expression](_expression_.expression.md)[]): *[Bool](_expression_.bool.md)* 128 | 129 | *Defined in [expression.ts:224](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L224)* 130 | 131 | **Parameters:** 132 | 133 | Name | Type | 134 | ------ | ------ | 135 | `...expressions` | [Expression](_expression_.expression.md)[] | 136 | 137 | **Returns:** *[Bool](_expression_.bool.md)* 138 | 139 | ___ 140 | 141 | ### `Static` should 142 | 143 | ▸ **should**(...`expressions`: [Expression](_expression_.expression.md)[]): *[Expression](_expression_.expression.md)* 144 | 145 | *Defined in [expression.ts:228](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L228)* 146 | 147 | **Parameters:** 148 | 149 | Name | Type | 150 | ------ | ------ | 151 | `...expressions` | [Expression](_expression_.expression.md)[] | 152 | 153 | **Returns:** *[Expression](_expression_.expression.md)* 154 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.expression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.expression" 3 | title: "Expression" 4 | sidebar_label: "Expression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **Expression** 10 | 11 | ↳ [Params](_expression_.params.md) 12 | 13 | ↳ [Literal](_expression_.literal.md) 14 | 15 | ↳ [ParamsExpression](_expression_.paramsexpression.md) 16 | 17 | ↳ [Source](_expression_.source.md) 18 | 19 | ↳ [Field](_document_.field.md) 20 | 21 | ## Index 22 | 23 | ### Properties 24 | 25 | * [queryKey](_expression_.expression.md#querykey) 26 | * [queryName](_expression_.expression.md#queryname) 27 | * [visitName](_expression_.expression.md#visitname) 28 | 29 | ### Methods 30 | 31 | * [collectDocClasses](_expression_.expression.md#collectdocclasses) 32 | 33 | ## Properties 34 | 35 | ### queryKey 36 | 37 | • **queryKey**: *string* 38 | 39 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 40 | 41 | ___ 42 | 43 | ### queryName 44 | 45 | • **queryName**: *string* 46 | 47 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 48 | 49 | ___ 50 | 51 | ### visitName 52 | 53 | • **visitName**: *string* 54 | 55 | *Defined in [expression.ts:14](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L14)* 56 | 57 | ## Methods 58 | 59 | ### collectDocClasses 60 | 61 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 62 | 63 | *Defined in [expression.ts:18](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L18)* 64 | 65 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 66 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.fieldexpression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.fieldexpression" 3 | title: "FieldExpression" 4 | sidebar_label: "FieldExpression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [QueryExpression](_expression_.queryexpression.md) 10 | 11 | ↳ **FieldExpression** 12 | 13 | ↳ [FieldQueryExpression](_expression_.fieldqueryexpression.md) 14 | 15 | ↳ [Terms](_expression_.terms.md) 16 | 17 | ↳ [RangeExpr](_expression_.rangeexpr.md) 18 | 19 | ## Index 20 | 21 | ### Constructors 22 | 23 | * [constructor](_expression_.fieldexpression.md#constructor) 24 | 25 | ### Properties 26 | 27 | * [field](_expression_.fieldexpression.md#field) 28 | * [params](_expression_.fieldexpression.md#params) 29 | * [queryKey](_expression_.fieldexpression.md#querykey) 30 | * [queryName](_expression_.fieldexpression.md#queryname) 31 | * [visitName](_expression_.fieldexpression.md#visitname) 32 | 33 | ### Methods 34 | 35 | * [collectDocClasses](_expression_.fieldexpression.md#collectdocclasses) 36 | 37 | ## Constructors 38 | 39 | ### constructor 40 | 41 | \+ **new FieldExpression**(`field`: [Field](_document_.field.md), `params?`: [Dictionary](../modules/_types_.md#dictionary)‹any, any›): *[FieldExpression](_expression_.fieldexpression.md)* 42 | 43 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 44 | 45 | *Defined in [expression.ts:103](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L103)* 46 | 47 | **Parameters:** 48 | 49 | Name | Type | 50 | ------ | ------ | 51 | `field` | [Field](_document_.field.md) | 52 | `params?` | [Dictionary](../modules/_types_.md#dictionary)‹any, any› | 53 | 54 | **Returns:** *[FieldExpression](_expression_.fieldexpression.md)* 55 | 56 | ## Properties 57 | 58 | ### field 59 | 60 | • **field**: *[Field](_document_.field.md)* 61 | 62 | *Defined in [expression.ts:105](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L105)* 63 | 64 | ___ 65 | 66 | ### params 67 | 68 | • **params**: *[Params](_expression_.params.md)* 69 | 70 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 71 | 72 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 73 | 74 | ___ 75 | 76 | ### queryKey 77 | 78 | • **queryKey**: *string* 79 | 80 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 81 | 82 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 83 | 84 | ___ 85 | 86 | ### queryName 87 | 88 | • **queryName**: *string* 89 | 90 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 91 | 92 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 93 | 94 | ___ 95 | 96 | ### visitName 97 | 98 | • **visitName**: *string* = "fieldExpression" 99 | 100 | *Overrides [QueryExpression](_expression_.queryexpression.md).[visitName](_expression_.queryexpression.md#visitname)* 101 | 102 | *Defined in [expression.ts:103](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L103)* 103 | 104 | ## Methods 105 | 106 | ### collectDocClasses 107 | 108 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 109 | 110 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 111 | 112 | *Defined in [expression.ts:109](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L109)* 113 | 114 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 115 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.fieldqueryexpression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.fieldqueryexpression" 3 | title: "FieldQueryExpression" 4 | sidebar_label: "FieldQueryExpression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [FieldExpression](_expression_.fieldexpression.md) 10 | 11 | ↳ **FieldQueryExpression** 12 | 13 | ↳ [Term](_expression_.term.md) 14 | 15 | ## Index 16 | 17 | ### Constructors 18 | 19 | * [constructor](_expression_.fieldqueryexpression.md#constructor) 20 | 21 | ### Properties 22 | 23 | * [field](_expression_.fieldqueryexpression.md#field) 24 | * [params](_expression_.fieldqueryexpression.md#params) 25 | * [query](_expression_.fieldqueryexpression.md#query) 26 | * [queryKey](_expression_.fieldqueryexpression.md#querykey) 27 | * [queryName](_expression_.fieldqueryexpression.md#queryname) 28 | * [visitName](_expression_.fieldqueryexpression.md#visitname) 29 | 30 | ### Methods 31 | 32 | * [collectDocClasses](_expression_.fieldqueryexpression.md#collectdocclasses) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new FieldQueryExpression**(`field`: [Field](_document_.field.md), `query`: [FieldQueryValue](../modules/_expression_.md#fieldqueryvalue)): *[FieldQueryExpression](_expression_.fieldqueryexpression.md)* 39 | 40 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[constructor](_expression_.fieldexpression.md#constructor)* 41 | 42 | *Defined in [expression.ts:122](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L122)* 43 | 44 | **Parameters:** 45 | 46 | Name | Type | 47 | ------ | ------ | 48 | `field` | [Field](_document_.field.md) | 49 | `query` | [FieldQueryValue](../modules/_expression_.md#fieldqueryvalue) | 50 | 51 | **Returns:** *[FieldQueryExpression](_expression_.fieldqueryexpression.md)* 52 | 53 | ## Properties 54 | 55 | ### field 56 | 57 | • **field**: *[Field](_document_.field.md)* 58 | 59 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[field](_expression_.fieldexpression.md#field)* 60 | 61 | *Defined in [expression.ts:105](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L105)* 62 | 63 | ___ 64 | 65 | ### params 66 | 67 | • **params**: *[Params](_expression_.params.md)* 68 | 69 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 70 | 71 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 72 | 73 | ___ 74 | 75 | ### query 76 | 77 | • **query**: *[FieldQueryValue](../modules/_expression_.md#fieldqueryvalue)* 78 | 79 | *Defined in [expression.ts:124](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L124)* 80 | 81 | ___ 82 | 83 | ### queryKey 84 | 85 | • **queryKey**: *string* = "query" 86 | 87 | *Overrides [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 88 | 89 | *Defined in [expression.ts:122](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L122)* 90 | 91 | ___ 92 | 93 | ### queryName 94 | 95 | • **queryName**: *string* 96 | 97 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 98 | 99 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 100 | 101 | ___ 102 | 103 | ### visitName 104 | 105 | • **visitName**: *string* = "fieldQuery" 106 | 107 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[visitName](_expression_.fieldexpression.md#visitname)* 108 | 109 | *Defined in [expression.ts:121](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L121)* 110 | 111 | ## Methods 112 | 113 | ### collectDocClasses 114 | 115 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 116 | 117 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[collectDocClasses](_expression_.fieldexpression.md#collectdocclasses)* 118 | 119 | *Defined in [expression.ts:128](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L128)* 120 | 121 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 122 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.literal.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.literal" 3 | title: "Literal" 4 | sidebar_label: "Literal" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [Expression](_expression_.expression.md) 10 | 11 | ↳ **Literal** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.literal.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [obj](_expression_.literal.md#obj) 22 | * [queryKey](_expression_.literal.md#querykey) 23 | * [queryName](_expression_.literal.md#queryname) 24 | * [visitName](_expression_.literal.md#visitname) 25 | 26 | ### Methods 27 | 28 | * [collectDocClasses](_expression_.literal.md#collectdocclasses) 29 | 30 | ## Constructors 31 | 32 | ### constructor 33 | 34 | \+ **new Literal**(`obj`: any): *[Literal](_expression_.literal.md)* 35 | 36 | *Defined in [expression.ts:57](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L57)* 37 | 38 | **Parameters:** 39 | 40 | Name | Type | 41 | ------ | ------ | 42 | `obj` | any | 43 | 44 | **Returns:** *[Literal](_expression_.literal.md)* 45 | 46 | ## Properties 47 | 48 | ### obj 49 | 50 | • **obj**: *any* 51 | 52 | *Defined in [expression.ts:59](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L59)* 53 | 54 | ___ 55 | 56 | ### queryKey 57 | 58 | • **queryKey**: *string* 59 | 60 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 61 | 62 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 63 | 64 | ___ 65 | 66 | ### queryName 67 | 68 | • **queryName**: *string* 69 | 70 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 71 | 72 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 73 | 74 | ___ 75 | 76 | ### visitName 77 | 78 | • **visitName**: *string* = "literal" 79 | 80 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 81 | 82 | *Defined in [expression.ts:57](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L57)* 83 | 84 | ## Methods 85 | 86 | ### collectDocClasses 87 | 88 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 89 | 90 | *Inherited from [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 91 | 92 | *Defined in [expression.ts:18](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L18)* 93 | 94 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 95 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.params.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.params" 3 | title: "Params" 4 | sidebar_label: "Params" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [Expression](_expression_.expression.md) 10 | 11 | ↳ **Params** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.params.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [params](_expression_.params.md#private-params) 22 | * [paramsKvList](_expression_.params.md#private-paramskvlist) 23 | * [queryKey](_expression_.params.md#querykey) 24 | * [queryName](_expression_.params.md#queryname) 25 | * [visitName](_expression_.params.md#visitname) 26 | 27 | ### Accessors 28 | 29 | * [length](_expression_.params.md#length) 30 | 31 | ### Methods 32 | 33 | * [collectDocClasses](_expression_.params.md#collectdocclasses) 34 | * [getParams](_expression_.params.md#getparams) 35 | * [getParamsKvList](_expression_.params.md#getparamskvlist) 36 | 37 | ## Constructors 38 | 39 | ### constructor 40 | 41 | \+ **new Params**(`params?`: [Nullable](../modules/_types_.md#nullable)‹[ParamsType](../modules/_expression_.md#paramstype)›): *[Params](_expression_.params.md)* 42 | 43 | *Defined in [expression.ts:30](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L30)* 44 | 45 | **Parameters:** 46 | 47 | Name | Type | 48 | ------ | ------ | 49 | `params?` | [Nullable](../modules/_types_.md#nullable)‹[ParamsType](../modules/_expression_.md#paramstype)› | 50 | 51 | **Returns:** *[Params](_expression_.params.md)* 52 | 53 | ## Properties 54 | 55 | ### `Private` params 56 | 57 | • **params**: *[ParamsType](../modules/_expression_.md#paramstype)* 58 | 59 | *Defined in [expression.ts:29](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L29)* 60 | 61 | ___ 62 | 63 | ### `Private` paramsKvList 64 | 65 | • **paramsKvList**: *[ParamKV](../modules/_expression_.md#paramkv)[]* 66 | 67 | *Defined in [expression.ts:30](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L30)* 68 | 69 | ___ 70 | 71 | ### queryKey 72 | 73 | • **queryKey**: *string* 74 | 75 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 76 | 77 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 78 | 79 | ___ 80 | 81 | ### queryName 82 | 83 | • **queryName**: *string* 84 | 85 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 86 | 87 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 88 | 89 | ___ 90 | 91 | ### visitName 92 | 93 | • **visitName**: *string* = "params" 94 | 95 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 96 | 97 | *Defined in [expression.ts:28](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L28)* 98 | 99 | ## Accessors 100 | 101 | ### length 102 | 103 | • **get length**(): *number* 104 | 105 | *Defined in [expression.ts:50](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L50)* 106 | 107 | **Returns:** *number* 108 | 109 | ## Methods 110 | 111 | ### collectDocClasses 112 | 113 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 114 | 115 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 116 | 117 | *Defined in [expression.ts:46](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L46)* 118 | 119 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 120 | 121 | ___ 122 | 123 | ### getParams 124 | 125 | ▸ **getParams**(): *[ParamsType](../modules/_expression_.md#paramstype)* 126 | 127 | *Defined in [expression.ts:42](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L42)* 128 | 129 | **Returns:** *[ParamsType](../modules/_expression_.md#paramstype)* 130 | 131 | ___ 132 | 133 | ### getParamsKvList 134 | 135 | ▸ **getParamsKvList**(): *[ParamKV](../modules/_expression_.md#paramkv)[]* 136 | 137 | *Defined in [expression.ts:38](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L38)* 138 | 139 | **Returns:** *[ParamKV](../modules/_expression_.md#paramkv)[]* 140 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.paramsexpression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.paramsexpression" 3 | title: "ParamsExpression" 4 | sidebar_label: "ParamsExpression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [Expression](_expression_.expression.md) 10 | 11 | ↳ **ParamsExpression** 12 | 13 | ↳ [QueryExpression](_expression_.queryexpression.md) 14 | 15 | ↳ [AggExpression](_agg_.aggexpression.md) 16 | 17 | ## Index 18 | 19 | ### Constructors 20 | 21 | * [constructor](_expression_.paramsexpression.md#constructor) 22 | 23 | ### Properties 24 | 25 | * [params](_expression_.paramsexpression.md#params) 26 | * [queryKey](_expression_.paramsexpression.md#querykey) 27 | * [queryName](_expression_.paramsexpression.md#queryname) 28 | * [visitName](_expression_.paramsexpression.md#visitname) 29 | 30 | ### Methods 31 | 32 | * [collectDocClasses](_expression_.paramsexpression.md#collectdocclasses) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | \+ **new ParamsExpression**(`params?`: [Dictionary](../modules/_types_.md#dictionary)‹any, any›): *[ParamsExpression](_expression_.paramsexpression.md)* 39 | 40 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 41 | 42 | **Parameters:** 43 | 44 | Name | Type | 45 | ------ | ------ | 46 | `params?` | [Dictionary](../modules/_types_.md#dictionary)‹any, any› | 47 | 48 | **Returns:** *[ParamsExpression](_expression_.paramsexpression.md)* 49 | 50 | ## Properties 51 | 52 | ### params 53 | 54 | • **params**: *[Params](_expression_.params.md)* 55 | 56 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 57 | 58 | ___ 59 | 60 | ### queryKey 61 | 62 | • **queryKey**: *string* 63 | 64 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 65 | 66 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 67 | 68 | ___ 69 | 70 | ### queryName 71 | 72 | • **queryName**: *string* 73 | 74 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 75 | 76 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 77 | 78 | ___ 79 | 80 | ### visitName 81 | 82 | • **visitName**: *string* 83 | 84 | *Inherited from [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 85 | 86 | *Defined in [expression.ts:14](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L14)* 87 | 88 | ## Methods 89 | 90 | ### collectDocClasses 91 | 92 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 93 | 94 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 95 | 96 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 97 | 98 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 99 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.queryexpression.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.queryexpression" 3 | title: "QueryExpression" 4 | sidebar_label: "QueryExpression" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [ParamsExpression](_expression_.paramsexpression.md) 10 | 11 | ↳ **QueryExpression** 12 | 13 | ↳ [FieldExpression](_expression_.fieldexpression.md) 14 | 15 | ↳ [Bool](_expression_.bool.md) 16 | 17 | ↳ [Sort](_expression_.sort.md) 18 | 19 | ## Index 20 | 21 | ### Constructors 22 | 23 | * [constructor](_expression_.queryexpression.md#constructor) 24 | 25 | ### Properties 26 | 27 | * [params](_expression_.queryexpression.md#params) 28 | * [queryKey](_expression_.queryexpression.md#querykey) 29 | * [queryName](_expression_.queryexpression.md#queryname) 30 | * [visitName](_expression_.queryexpression.md#visitname) 31 | 32 | ### Methods 33 | 34 | * [collectDocClasses](_expression_.queryexpression.md#collectdocclasses) 35 | 36 | ## Constructors 37 | 38 | ### constructor 39 | 40 | \+ **new QueryExpression**(`params?`: [Dictionary](../modules/_types_.md#dictionary)‹any, any›): *[QueryExpression](_expression_.queryexpression.md)* 41 | 42 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 43 | 44 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 45 | 46 | **Parameters:** 47 | 48 | Name | Type | 49 | ------ | ------ | 50 | `params?` | [Dictionary](../modules/_types_.md#dictionary)‹any, any› | 51 | 52 | **Returns:** *[QueryExpression](_expression_.queryexpression.md)* 53 | 54 | ## Properties 55 | 56 | ### params 57 | 58 | • **params**: *[Params](_expression_.params.md)* 59 | 60 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 61 | 62 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 63 | 64 | ___ 65 | 66 | ### queryKey 67 | 68 | • **queryKey**: *string* 69 | 70 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 71 | 72 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 73 | 74 | ___ 75 | 76 | ### queryName 77 | 78 | • **queryName**: *string* 79 | 80 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 81 | 82 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 83 | 84 | ___ 85 | 86 | ### visitName 87 | 88 | • **visitName**: *string* = "queryExpression" 89 | 90 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 91 | 92 | *Defined in [expression.ts:99](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L99)* 93 | 94 | ## Methods 95 | 96 | ### collectDocClasses 97 | 98 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 99 | 100 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 101 | 102 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 103 | 104 | *Defined in [expression.ts:72](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L72)* 105 | 106 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 107 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.rangeexpr.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.rangeexpr" 3 | title: "RangeExpr" 4 | sidebar_label: "RangeExpr" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [FieldExpression](_expression_.fieldexpression.md) 10 | 11 | ↳ **RangeExpr** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.rangeexpr.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [field](_expression_.rangeexpr.md#field) 22 | * [params](_expression_.rangeexpr.md#params) 23 | * [queryKey](_expression_.rangeexpr.md#querykey) 24 | * [queryName](_expression_.rangeexpr.md#queryname) 25 | * [rangeParams](_expression_.rangeexpr.md#rangeparams) 26 | * [visitName](_expression_.rangeexpr.md#visitname) 27 | 28 | ### Methods 29 | 30 | * [collectDocClasses](_expression_.rangeexpr.md#collectdocclasses) 31 | 32 | ## Constructors 33 | 34 | ### constructor 35 | 36 | \+ **new RangeExpr**(`field`: [Field](_document_.field.md), `rangeOpts`: [RangeOptions](../modules/_expression_.md#rangeoptions), `rangeSettings?`: [RangeSettings](../modules/_expression_.md#rangesettings)): *[RangeExpr](_expression_.rangeexpr.md)* 37 | 38 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[constructor](_expression_.fieldexpression.md#constructor)* 39 | 40 | *Defined in [expression.ts:188](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L188)* 41 | 42 | **Parameters:** 43 | 44 | Name | Type | 45 | ------ | ------ | 46 | `field` | [Field](_document_.field.md) | 47 | `rangeOpts` | [RangeOptions](../modules/_expression_.md#rangeoptions) | 48 | `rangeSettings?` | [RangeSettings](../modules/_expression_.md#rangesettings) | 49 | 50 | **Returns:** *[RangeExpr](_expression_.rangeexpr.md)* 51 | 52 | ## Properties 53 | 54 | ### field 55 | 56 | • **field**: *[Field](_document_.field.md)* 57 | 58 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[field](_expression_.fieldexpression.md#field)* 59 | 60 | *Defined in [expression.ts:105](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L105)* 61 | 62 | ___ 63 | 64 | ### params 65 | 66 | • **params**: *[Params](_expression_.params.md)* 67 | 68 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 69 | 70 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 71 | 72 | ___ 73 | 74 | ### queryKey 75 | 76 | • **queryKey**: *string* 77 | 78 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 79 | 80 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 81 | 82 | ___ 83 | 84 | ### queryName 85 | 86 | • **queryName**: *string* 87 | 88 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 89 | 90 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 91 | 92 | ___ 93 | 94 | ### rangeParams 95 | 96 | • **rangeParams**: *[Params](_expression_.params.md)* = new Params() 97 | 98 | *Defined in [expression.ts:188](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L188)* 99 | 100 | ___ 101 | 102 | ### visitName 103 | 104 | • **visitName**: *string* = "range" 105 | 106 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[visitName](_expression_.fieldexpression.md#visitname)* 107 | 108 | *Defined in [expression.ts:187](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L187)* 109 | 110 | ## Methods 111 | 112 | ### collectDocClasses 113 | 114 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 115 | 116 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[collectDocClasses](_expression_.fieldexpression.md#collectdocclasses)* 117 | 118 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 119 | 120 | *Defined in [expression.ts:109](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L109)* 121 | 122 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 123 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.sort.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.sort" 3 | title: "Sort" 4 | sidebar_label: "Sort" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [QueryExpression](_expression_.queryexpression.md) 10 | 11 | ↳ **Sort** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.sort.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [field](_expression_.sort.md#field) 22 | * [order](_expression_.sort.md#order) 23 | * [params](_expression_.sort.md#params) 24 | * [queryKey](_expression_.sort.md#querykey) 25 | * [queryName](_expression_.sort.md#queryname) 26 | * [visitName](_expression_.sort.md#visitname) 27 | 28 | ### Methods 29 | 30 | * [collectDocClasses](_expression_.sort.md#collectdocclasses) 31 | 32 | ## Constructors 33 | 34 | ### constructor 35 | 36 | \+ **new Sort**(`field`: [Field](_document_.field.md), `order`: "asc" | "desc", `opts?`: [SortOpts](../modules/_expression_.md#sortopts)): *[Sort](_expression_.sort.md)* 37 | 38 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[constructor](_expression_.paramsexpression.md#constructor)* 39 | 40 | *Defined in [expression.ts:244](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L244)* 41 | 42 | **Parameters:** 43 | 44 | Name | Type | 45 | ------ | ------ | 46 | `field` | [Field](_document_.field.md) | 47 | `order` | "asc" | "desc" | 48 | `opts?` | [SortOpts](../modules/_expression_.md#sortopts) | 49 | 50 | **Returns:** *[Sort](_expression_.sort.md)* 51 | 52 | ## Properties 53 | 54 | ### field 55 | 56 | • **field**: *[Field](_document_.field.md)* 57 | 58 | *Defined in [expression.ts:247](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L247)* 59 | 60 | ___ 61 | 62 | ### order 63 | 64 | • **order**: *"asc" | "desc"* 65 | 66 | *Defined in [expression.ts:248](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L248)* 67 | 68 | ___ 69 | 70 | ### params 71 | 72 | • **params**: *[Params](_expression_.params.md)* 73 | 74 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 75 | 76 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 77 | 78 | ___ 79 | 80 | ### queryKey 81 | 82 | • **queryKey**: *string* 83 | 84 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 85 | 86 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 87 | 88 | ___ 89 | 90 | ### queryName 91 | 92 | • **queryName**: *string* 93 | 94 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 95 | 96 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 97 | 98 | ___ 99 | 100 | ### visitName 101 | 102 | • **visitName**: *string* = "sort" 103 | 104 | *Overrides [QueryExpression](_expression_.queryexpression.md).[visitName](_expression_.queryexpression.md#visitname)* 105 | 106 | *Defined in [expression.ts:244](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L244)* 107 | 108 | ## Methods 109 | 110 | ### collectDocClasses 111 | 112 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 113 | 114 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 115 | 116 | *Defined in [expression.ts:254](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L254)* 117 | 118 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 119 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.source.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.source" 3 | title: "Source" 4 | sidebar_label: "Source" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * [Expression](_expression_.expression.md) 10 | 11 | ↳ **Source** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.source.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [exclude](_expression_.source.md#optional-exclude) 22 | * [fields](_expression_.source.md#fields) 23 | * [include](_expression_.source.md#optional-include) 24 | * [queryKey](_expression_.source.md#querykey) 25 | * [queryName](_expression_.source.md#queryname) 26 | * [visitName](_expression_.source.md#visitname) 27 | 28 | ### Methods 29 | 30 | * [collectDocClasses](_expression_.source.md#collectdocclasses) 31 | 32 | ## Constructors 33 | 34 | ### constructor 35 | 36 | \+ **new Source**(`fields`: boolean | string | [Field](_document_.field.md) | Array‹string | [Field](_document_.field.md)›, `include?`: Array‹string | [Field](_document_.field.md)›, `exclude?`: Array‹string | [Field](_document_.field.md)›): *[Source](_expression_.source.md)* 37 | 38 | *Defined in [expression.ts:79](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L79)* 39 | 40 | **Parameters:** 41 | 42 | Name | Type | 43 | ------ | ------ | 44 | `fields` | boolean | string | [Field](_document_.field.md) | Array‹string | [Field](_document_.field.md)› | 45 | `include?` | Array‹string | [Field](_document_.field.md)› | 46 | `exclude?` | Array‹string | [Field](_document_.field.md)› | 47 | 48 | **Returns:** *[Source](_expression_.source.md)* 49 | 50 | ## Properties 51 | 52 | ### `Optional` exclude 53 | 54 | • **exclude**? : *Array‹string | [Field](_document_.field.md)›* 55 | 56 | *Defined in [expression.ts:84](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L84)* 57 | 58 | ___ 59 | 60 | ### fields 61 | 62 | • **fields**: *boolean | string | [Field](_document_.field.md) | Array‹string | [Field](_document_.field.md)›* 63 | 64 | *Defined in [expression.ts:82](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L82)* 65 | 66 | ___ 67 | 68 | ### `Optional` include 69 | 70 | • **include**? : *Array‹string | [Field](_document_.field.md)›* 71 | 72 | *Defined in [expression.ts:83](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L83)* 73 | 74 | ___ 75 | 76 | ### queryKey 77 | 78 | • **queryKey**: *string* 79 | 80 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 81 | 82 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 83 | 84 | ___ 85 | 86 | ### queryName 87 | 88 | • **queryName**: *string* 89 | 90 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 91 | 92 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 93 | 94 | ___ 95 | 96 | ### visitName 97 | 98 | • **visitName**: *string* = "source" 99 | 100 | *Overrides [Expression](_expression_.expression.md).[visitName](_expression_.expression.md#visitname)* 101 | 102 | *Defined in [expression.ts:79](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L79)* 103 | 104 | ## Methods 105 | 106 | ### collectDocClasses 107 | 108 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 109 | 110 | *Overrides [Expression](_expression_.expression.md).[collectDocClasses](_expression_.expression.md#collectdocclasses)* 111 | 112 | *Defined in [expression.ts:89](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L89)* 113 | 114 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 115 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.term.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.term" 3 | title: "Term" 4 | sidebar_label: "Term" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [FieldQueryExpression](_expression_.fieldqueryexpression.md) 10 | 11 | ↳ **Term** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.term.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [field](_expression_.term.md#field) 22 | * [params](_expression_.term.md#params) 23 | * [query](_expression_.term.md#query) 24 | * [queryKey](_expression_.term.md#querykey) 25 | * [queryName](_expression_.term.md#queryname) 26 | * [visitName](_expression_.term.md#visitname) 27 | 28 | ### Methods 29 | 30 | * [collectDocClasses](_expression_.term.md#collectdocclasses) 31 | 32 | ## Constructors 33 | 34 | ### constructor 35 | 36 | \+ **new Term**(`field`: [Field](_document_.field.md), `term`: [TermValue](../modules/_expression_.md#termvalue)): *[Term](_expression_.term.md)* 37 | 38 | *Overrides [FieldQueryExpression](_expression_.fieldqueryexpression.md).[constructor](_expression_.fieldqueryexpression.md#constructor)* 39 | 40 | *Defined in [expression.ts:138](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L138)* 41 | 42 | **Parameters:** 43 | 44 | Name | Type | 45 | ------ | ------ | 46 | `field` | [Field](_document_.field.md) | 47 | `term` | [TermValue](../modules/_expression_.md#termvalue) | 48 | 49 | **Returns:** *[Term](_expression_.term.md)* 50 | 51 | ## Properties 52 | 53 | ### field 54 | 55 | • **field**: *[Field](_document_.field.md)* 56 | 57 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[field](_expression_.fieldexpression.md#field)* 58 | 59 | *Defined in [expression.ts:105](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L105)* 60 | 61 | ___ 62 | 63 | ### params 64 | 65 | • **params**: *[Params](_expression_.params.md)* 66 | 67 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 68 | 69 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 70 | 71 | ___ 72 | 73 | ### query 74 | 75 | • **query**: *[FieldQueryValue](../modules/_expression_.md#fieldqueryvalue)* 76 | 77 | *Inherited from [FieldQueryExpression](_expression_.fieldqueryexpression.md).[query](_expression_.fieldqueryexpression.md#query)* 78 | 79 | *Defined in [expression.ts:124](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L124)* 80 | 81 | ___ 82 | 83 | ### queryKey 84 | 85 | • **queryKey**: *string* = "value" 86 | 87 | *Overrides [FieldQueryExpression](_expression_.fieldqueryexpression.md).[queryKey](_expression_.fieldqueryexpression.md#querykey)* 88 | 89 | *Defined in [expression.ts:138](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L138)* 90 | 91 | ___ 92 | 93 | ### queryName 94 | 95 | • **queryName**: *string* = "term" 96 | 97 | *Overrides [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 98 | 99 | *Defined in [expression.ts:137](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L137)* 100 | 101 | ___ 102 | 103 | ### visitName 104 | 105 | • **visitName**: *string* = "term" 106 | 107 | *Overrides [FieldQueryExpression](_expression_.fieldqueryexpression.md).[visitName](_expression_.fieldqueryexpression.md#visitname)* 108 | 109 | *Defined in [expression.ts:136](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L136)* 110 | 111 | ## Methods 112 | 113 | ### collectDocClasses 114 | 115 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 116 | 117 | *Inherited from [FieldQueryExpression](_expression_.fieldqueryexpression.md).[collectDocClasses](_expression_.fieldqueryexpression.md#collectdocclasses)* 118 | 119 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[collectDocClasses](_expression_.fieldexpression.md#collectdocclasses)* 120 | 121 | *Defined in [expression.ts:128](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L128)* 122 | 123 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 124 | -------------------------------------------------------------------------------- /website/docs/api/classes/_expression_.terms.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_.terms" 3 | title: "Terms" 4 | sidebar_label: "Terms" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | ↳ [FieldExpression](_expression_.fieldexpression.md) 10 | 11 | ↳ **Terms** 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_expression_.terms.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [field](_expression_.terms.md#field) 22 | * [params](_expression_.terms.md#params) 23 | * [queryKey](_expression_.terms.md#querykey) 24 | * [queryName](_expression_.terms.md#queryname) 25 | * [terms](_expression_.terms.md#terms) 26 | * [visitName](_expression_.terms.md#visitname) 27 | 28 | ### Methods 29 | 30 | * [collectDocClasses](_expression_.terms.md#collectdocclasses) 31 | 32 | ## Constructors 33 | 34 | ### constructor 35 | 36 | \+ **new Terms**(`field`: [Field](_document_.field.md), `terms`: [TermValue](../modules/_expression_.md#termvalue)[], `termsOptions?`: [TermsOptions](../modules/_expression_.md#termsoptions)): *[Terms](_expression_.terms.md)* 37 | 38 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[constructor](_expression_.fieldexpression.md#constructor)* 39 | 40 | *Defined in [expression.ts:154](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L154)* 41 | 42 | **Parameters:** 43 | 44 | Name | Type | 45 | ------ | ------ | 46 | `field` | [Field](_document_.field.md) | 47 | `terms` | [TermValue](../modules/_expression_.md#termvalue)[] | 48 | `termsOptions?` | [TermsOptions](../modules/_expression_.md#termsoptions) | 49 | 50 | **Returns:** *[Terms](_expression_.terms.md)* 51 | 52 | ## Properties 53 | 54 | ### field 55 | 56 | • **field**: *[Field](_document_.field.md)* 57 | 58 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[field](_expression_.fieldexpression.md#field)* 59 | 60 | *Defined in [expression.ts:105](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L105)* 61 | 62 | ___ 63 | 64 | ### params 65 | 66 | • **params**: *[Params](_expression_.params.md)* 67 | 68 | *Inherited from [ParamsExpression](_expression_.paramsexpression.md).[params](_expression_.paramsexpression.md#params)* 69 | 70 | *Defined in [expression.ts:65](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L65)* 71 | 72 | ___ 73 | 74 | ### queryKey 75 | 76 | • **queryKey**: *string* 77 | 78 | *Inherited from [Expression](_expression_.expression.md).[queryKey](_expression_.expression.md#querykey)* 79 | 80 | *Defined in [expression.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L16)* 81 | 82 | ___ 83 | 84 | ### queryName 85 | 86 | • **queryName**: *string* 87 | 88 | *Inherited from [Expression](_expression_.expression.md).[queryName](_expression_.expression.md#queryname)* 89 | 90 | *Defined in [expression.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L15)* 91 | 92 | ___ 93 | 94 | ### terms 95 | 96 | • **terms**: *[TermValue](../modules/_expression_.md#termvalue)[]* 97 | 98 | *Defined in [expression.ts:158](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L158)* 99 | 100 | ___ 101 | 102 | ### visitName 103 | 104 | • **visitName**: *string* = "terms" 105 | 106 | *Overrides [FieldExpression](_expression_.fieldexpression.md).[visitName](_expression_.fieldexpression.md#visitname)* 107 | 108 | *Defined in [expression.ts:154](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L154)* 109 | 110 | ## Methods 111 | 112 | ### collectDocClasses 113 | 114 | ▸ **collectDocClasses**(): *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 115 | 116 | *Inherited from [FieldExpression](_expression_.fieldexpression.md).[collectDocClasses](_expression_.fieldexpression.md#collectdocclasses)* 117 | 118 | *Overrides [ParamsExpression](_expression_.paramsexpression.md).[collectDocClasses](_expression_.paramsexpression.md#collectdocclasses)* 119 | 120 | *Defined in [expression.ts:109](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L109)* 121 | 122 | **Returns:** *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 123 | -------------------------------------------------------------------------------- /website/docs/api/classes/_result_.result.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_result_.result" 3 | title: "Result" 4 | sidebar_label: "Result" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **Result** 10 | 11 | ↳ [SearchResult](_result_.searchresult.md) 12 | 13 | ## Index 14 | 15 | ### Constructors 16 | 17 | * [constructor](_result_.result.md#constructor) 18 | 19 | ### Properties 20 | 21 | * [raw](_result_.result.md#raw) 22 | 23 | ### Accessors 24 | 25 | * [prettyRaw](_result_.result.md#prettyraw) 26 | 27 | ## Constructors 28 | 29 | ### constructor 30 | 31 | \+ **new Result**(`raw`: [RawResultBody](../modules/_types_.md#rawresultbody)‹any›): *[Result](_result_.result.md)* 32 | 33 | *Defined in [result.ts:31](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L31)* 34 | 35 | **Parameters:** 36 | 37 | Name | Type | 38 | ------ | ------ | 39 | `raw` | [RawResultBody](../modules/_types_.md#rawresultbody)‹any› | 40 | 41 | **Returns:** *[Result](_result_.result.md)* 42 | 43 | ## Properties 44 | 45 | ### raw 46 | 47 | • **raw**: *[RawResultBody](../modules/_types_.md#rawresultbody)‹any›* 48 | 49 | *Defined in [result.ts:32](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L32)* 50 | 51 | ## Accessors 52 | 53 | ### prettyRaw 54 | 55 | • **get prettyRaw**(): *string* 56 | 57 | *Defined in [result.ts:34](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L34)* 58 | 59 | **Returns:** *string* 60 | -------------------------------------------------------------------------------- /website/docs/api/classes/_search_.searchquerycontext.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_search_.searchquerycontext" 3 | title: "SearchQueryContext" 4 | sidebar_label: "SearchQueryContext" 5 | --- 6 | 7 | ## Hierarchy 8 | 9 | * **SearchQueryContext** 10 | 11 | ## Index 12 | 13 | ### Constructors 14 | 15 | * [constructor](_search_.searchquerycontext.md#constructor) 16 | 17 | ### Properties 18 | 19 | * [aggregations](_search_.searchquerycontext.md#aggregations) 20 | * [docClasses](_search_.searchquerycontext.md#docclasses) 21 | * [docType](_search_.searchquerycontext.md#optional-doctype) 22 | * [docTypes](_search_.searchquerycontext.md#doctypes) 23 | * [fields](_search_.searchquerycontext.md#fields) 24 | * [filters](_search_.searchquerycontext.md#filters) 25 | * [instanceMapper](_search_.searchquerycontext.md#optional-instancemapper) 26 | * [limit](_search_.searchquerycontext.md#limit) 27 | * [query](_search_.searchquerycontext.md#query) 28 | * [searchParams](_search_.searchquerycontext.md#searchparams) 29 | * [sort](_search_.searchquerycontext.md#sort) 30 | * [source](_search_.searchquerycontext.md#source) 31 | * [visitName](_search_.searchquerycontext.md#visitname) 32 | 33 | ### Methods 34 | 35 | * [getUniqueDocTypes](_search_.searchquerycontext.md#private-getuniquedoctypes) 36 | 37 | ## Constructors 38 | 39 | ### constructor 40 | 41 | \+ **new SearchQueryContext**(`query`: [QueryOverride](../modules/_search_.md#queryoverride), `source`: [Source](_expression_.source.md) | null, `fields`: [Field](_document_.field.md)[], `filters`: [Expression](_expression_.expression.md)[], `sort`: [Sort](_expression_.sort.md)[], `limit`: [Limit](../modules/_search_.md#limit), `searchParams`: [Params](_expression_.params.md), `aggregations`: [Params](_expression_.params.md), `docClasses`: Readonly‹[DocClass](../modules/_document_.md#docclass)[]›, `docType?`: undefined | string, `instanceMapper?`: [InstanceMapper](../modules/_search_.md#instancemapper)‹any›): *[SearchQueryContext](_search_.searchquerycontext.md)* 42 | 43 | *Defined in [search.ts:114](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L114)* 44 | 45 | **Parameters:** 46 | 47 | Name | Type | 48 | ------ | ------ | 49 | `query` | [QueryOverride](../modules/_search_.md#queryoverride) | 50 | `source` | [Source](_expression_.source.md) | null | 51 | `fields` | [Field](_document_.field.md)[] | 52 | `filters` | [Expression](_expression_.expression.md)[] | 53 | `sort` | [Sort](_expression_.sort.md)[] | 54 | `limit` | [Limit](../modules/_search_.md#limit) | 55 | `searchParams` | [Params](_expression_.params.md) | 56 | `aggregations` | [Params](_expression_.params.md) | 57 | `docClasses` | Readonly‹[DocClass](../modules/_document_.md#docclass)[]› | 58 | `docType?` | undefined | string | 59 | `instanceMapper?` | [InstanceMapper](../modules/_search_.md#instancemapper)‹any› | 60 | 61 | **Returns:** *[SearchQueryContext](_search_.searchquerycontext.md)* 62 | 63 | ## Properties 64 | 65 | ### aggregations 66 | 67 | • **aggregations**: *[Params](_expression_.params.md)* 68 | 69 | *Defined in [search.ts:124](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L124)* 70 | 71 | ___ 72 | 73 | ### docClasses 74 | 75 | • **docClasses**: *Readonly‹[DocClass](../modules/_document_.md#docclass)[]›* 76 | 77 | *Defined in [search.ts:125](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L125)* 78 | 79 | ___ 80 | 81 | ### `Optional` docType 82 | 83 | • **docType**? : *undefined | string* 84 | 85 | *Defined in [search.ts:126](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L126)* 86 | 87 | ___ 88 | 89 | ### docTypes 90 | 91 | • **docTypes**: *Readonly‹string[]›* = [] 92 | 93 | *Defined in [search.ts:114](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L114)* 94 | 95 | ___ 96 | 97 | ### fields 98 | 99 | • **fields**: *[Field](_document_.field.md)[]* 100 | 101 | *Defined in [search.ts:119](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L119)* 102 | 103 | ___ 104 | 105 | ### filters 106 | 107 | • **filters**: *[Expression](_expression_.expression.md)[]* 108 | 109 | *Defined in [search.ts:120](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L120)* 110 | 111 | ___ 112 | 113 | ### `Optional` instanceMapper 114 | 115 | • **instanceMapper**? : *[InstanceMapper](../modules/_search_.md#instancemapper)‹any›* 116 | 117 | *Defined in [search.ts:127](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L127)* 118 | 119 | ___ 120 | 121 | ### limit 122 | 123 | • **limit**: *[Limit](../modules/_search_.md#limit)* 124 | 125 | *Defined in [search.ts:122](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L122)* 126 | 127 | ___ 128 | 129 | ### query 130 | 131 | • **query**: *[QueryOverride](../modules/_search_.md#queryoverride)* 132 | 133 | *Defined in [search.ts:117](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L117)* 134 | 135 | ___ 136 | 137 | ### searchParams 138 | 139 | • **searchParams**: *[Params](_expression_.params.md)* 140 | 141 | *Defined in [search.ts:123](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L123)* 142 | 143 | ___ 144 | 145 | ### sort 146 | 147 | • **sort**: *[Sort](_expression_.sort.md)[]* 148 | 149 | *Defined in [search.ts:121](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L121)* 150 | 151 | ___ 152 | 153 | ### source 154 | 155 | • **source**: *[Source](_expression_.source.md) | null* 156 | 157 | *Defined in [search.ts:118](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L118)* 158 | 159 | ___ 160 | 161 | ### visitName 162 | 163 | • **visitName**: *string* = "searchQueryContext" 164 | 165 | *Defined in [search.ts:112](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L112)* 166 | 167 | ## Methods 168 | 169 | ### `Private` getUniqueDocTypes 170 | 171 | ▸ **getUniqueDocTypes**(`docTypes`: string[], `docClasses`: Readonly‹[DocClass](../modules/_document_.md#docclass)[]›): *Readonly‹string[]›* 172 | 173 | *Defined in [search.ts:143](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/search.ts#L143)* 174 | 175 | **Parameters:** 176 | 177 | Name | Type | 178 | ------ | ------ | 179 | `docTypes` | string[] | 180 | `docClasses` | Readonly‹[DocClass](../modules/_document_.md#docclass)[]› | 181 | 182 | **Returns:** *Readonly‹string[]›* 183 | -------------------------------------------------------------------------------- /website/docs/api/modules/_agg_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_agg_" 3 | title: "agg" 4 | sidebar_label: "agg" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [AggExpression](../classes/_agg_.aggexpression.md) 12 | * [AggResult](../classes/_agg_.aggresult.md) 13 | * [Bucket](../classes/_agg_.bucket.md) 14 | * [BucketAgg](../classes/_agg_.bucketagg.md) 15 | * [Filter](../classes/_agg_.filter.md) 16 | * [MultiBucketAgg](../classes/_agg_.multibucketagg.md) 17 | * [MultiBucketAggResult](../classes/_agg_.multibucketaggresult.md) 18 | * [SingleBucketAgg](../classes/_agg_.singlebucketagg.md) 19 | * [SingleBucketAggResult](../classes/_agg_.singlebucketaggresult.md) 20 | * [Terms](../classes/_agg_.terms.md) 21 | 22 | ### Type aliases 23 | 24 | * [BucketKey](_agg_.md#bucketkey) 25 | * [FilterOptions](_agg_.md#filteroptions) 26 | * [TermsOptions](_agg_.md#termsoptions) 27 | * [TermsOptionsShrink](_agg_.md#termsoptionsshrink) 28 | 29 | ### Functions 30 | 31 | * [getType](_agg_.md#gettype) 32 | * [sortByKey](_agg_.md#sortbykey) 33 | 34 | ## Type aliases 35 | 36 | ### BucketKey 37 | 38 | Ƭ **BucketKey**: *string | number* 39 | 40 | *Defined in [agg.ts:7](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L7)* 41 | 42 | ___ 43 | 44 | ### FilterOptions 45 | 46 | Ƭ **FilterOptions**: *object* 47 | 48 | *Defined in [agg.ts:258](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L258)* 49 | 50 | #### Type declaration: 51 | 52 | * **aggs**? : *[Dictionary](_types_.md#dictionary)‹string, [Filter](../classes/_agg_.filter.md)›* 53 | 54 | * **filter**: *[Expression](../classes/_expression_.expression.md)* 55 | 56 | ___ 57 | 58 | ### TermsOptions 59 | 60 | Ƭ **TermsOptions**: *object* 61 | 62 | *Defined in [agg.ts:224](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L224)* 63 | 64 | #### Type declaration: 65 | 66 | * **aggs**? : *[Dictionary](_types_.md#dictionary)‹string, [Filter](../classes/_agg_.filter.md)›* 67 | 68 | * **field**: *[Field](../classes/_document_.field.md)* 69 | 70 | * **instanceMapper**? : *[InstanceMapper](_search_.md#instancemapper)‹any›* 71 | 72 | * **script**? : *any* 73 | 74 | * **size**? : *undefined | number* 75 | 76 | * **type**? : *[FieldType](../classes/_document_.fieldtype.md)* 77 | 78 | ___ 79 | 80 | ### TermsOptionsShrink 81 | 82 | Ƭ **TermsOptionsShrink**: *object* 83 | 84 | *Defined in [agg.ts:233](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L233)* 85 | 86 | #### Type declaration: 87 | 88 | * **field**? : *[Field](../classes/_document_.field.md)* 89 | 90 | * **script**? : *any* 91 | 92 | * **size**? : *undefined | number* 93 | 94 | ## Functions 95 | 96 | ### getType 97 | 98 | ▸ **getType**(`field`: [Field](../classes/_document_.field.md), `type?`: [FieldType](../classes/_document_.fieldtype.md)): *[FieldType](../classes/_document_.fieldtype.md)* 99 | 100 | *Defined in [agg.ts:239](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L239)* 101 | 102 | **Parameters:** 103 | 104 | Name | Type | 105 | ------ | ------ | 106 | `field` | [Field](../classes/_document_.field.md) | 107 | `type?` | [FieldType](../classes/_document_.fieldtype.md) | 108 | 109 | **Returns:** *[FieldType](../classes/_document_.fieldtype.md)* 110 | 111 | ___ 112 | 113 | ### sortByKey 114 | 115 | ▸ **sortByKey**(`collection`: object): *Array‹[KVList](_types_.md#kvlist)‹string››* 116 | 117 | *Defined in [agg.ts:79](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/agg.ts#L79)* 118 | 119 | **Parameters:** 120 | 121 | Name | Type | 122 | ------ | ------ | 123 | `collection` | object | 124 | 125 | **Returns:** *Array‹[KVList](_types_.md#kvlist)‹string››* 126 | -------------------------------------------------------------------------------- /website/docs/api/modules/_cluster_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_cluster_" 3 | title: "cluster" 4 | sidebar_label: "cluster" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [Cluster](../classes/_cluster_.cluster.md) 12 | * [EsVersion](../classes/_cluster_.esversion.md) 13 | * [Index](../classes/_cluster_.index.md) 14 | 15 | ### Type aliases 16 | 17 | * [RootRawResult](_cluster_.md#rootrawresult) 18 | 19 | ## Type aliases 20 | 21 | ### RootRawResult 22 | 23 | Ƭ **RootRawResult**: *object* 24 | 25 | *Defined in [cluster.ts:8](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/cluster.ts#L8)* 26 | 27 | #### Type declaration: 28 | 29 | * **cluster_name**: *string* 30 | 31 | * **cluster_uuid**: *string* 32 | 33 | * **name**: *string* 34 | 35 | * **version**(): *object* 36 | 37 | * **number**: *string* 38 | -------------------------------------------------------------------------------- /website/docs/api/modules/_compiler_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_compiler_" 3 | title: "compiler" 4 | sidebar_label: "compiler" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [CompilerVisitor](../classes/_compiler_.compilervisitor.md) 12 | 13 | ### Functions 14 | 15 | * [isField](_compiler_.md#isfield) 16 | 17 | ## Functions 18 | 19 | ### isField 20 | 21 | ▸ **isField**(`x`: any): *x is Field* 22 | 23 | *Defined in [compiler.ts:19](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/compiler.ts#L19)* 24 | 25 | **Parameters:** 26 | 27 | Name | Type | 28 | ------ | ------ | 29 | `x` | any | 30 | 31 | **Returns:** *x is Field* 32 | -------------------------------------------------------------------------------- /website/docs/api/modules/_document_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_document_" 3 | title: "document" 4 | sidebar_label: "document" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [BooleanType](../classes/_document_.booleantype.md) 12 | * [DateType](../classes/_document_.datetype.md) 13 | * [Doc](../classes/_document_.doc.md) 14 | * [Field](../classes/_document_.field.md) 15 | * [FieldType](../classes/_document_.fieldtype.md) 16 | * [FloatType](../classes/_document_.floattype.md) 17 | * [IntegerType](../classes/_document_.integertype.md) 18 | * [StringType](../classes/_document_.stringtype.md) 19 | 20 | ### Type aliases 21 | 22 | * [DocClass](_document_.md#docclass) 23 | * [DocOpts](_document_.md#docopts) 24 | * [FieldOpts](_document_.md#fieldopts) 25 | 26 | ## Type aliases 27 | 28 | ### DocClass 29 | 30 | Ƭ **DocClass**: *[Doc](../classes/_document_.doc.md)* 31 | 32 | *Defined in [document.ts:146](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L146)* 33 | 34 | ___ 35 | 36 | ### DocOpts 37 | 38 | Ƭ **DocOpts**: *object* 39 | 40 | *Defined in [document.ts:89](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L89)* 41 | 42 | #### Type declaration: 43 | 44 | * **docType**: *string* 45 | 46 | * **hit**: *[Hit](_types_.md#hit)* 47 | 48 | * **result**: *[SearchResult](../classes/_result_.searchresult.md)‹any›* 49 | 50 | ___ 51 | 52 | ### FieldOpts 53 | 54 | Ƭ **FieldOpts**: *object* 55 | 56 | *Defined in [document.ts:27](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/document.ts#L27)* 57 | 58 | #### Type declaration: 59 | 60 | * **name**? : *undefined | string* 61 | 62 | * **parent**? : *[DocClass](_document_.md#docclass)* 63 | -------------------------------------------------------------------------------- /website/docs/api/modules/_expression_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_expression_" 3 | title: "expression" 4 | sidebar_label: "expression" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [Bool](../classes/_expression_.bool.md) 12 | * [Expression](../classes/_expression_.expression.md) 13 | * [FieldExpression](../classes/_expression_.fieldexpression.md) 14 | * [FieldQueryExpression](../classes/_expression_.fieldqueryexpression.md) 15 | * [Literal](../classes/_expression_.literal.md) 16 | * [Params](../classes/_expression_.params.md) 17 | * [ParamsExpression](../classes/_expression_.paramsexpression.md) 18 | * [QueryExpression](../classes/_expression_.queryexpression.md) 19 | * [RangeExpr](../classes/_expression_.rangeexpr.md) 20 | * [Sort](../classes/_expression_.sort.md) 21 | * [Source](../classes/_expression_.source.md) 22 | * [Term](../classes/_expression_.term.md) 23 | * [Terms](../classes/_expression_.terms.md) 24 | 25 | ### Type aliases 26 | 27 | * [BoolOptions](_expression_.md#booloptions) 28 | * [FieldQueryValue](_expression_.md#fieldqueryvalue) 29 | * [ISOString](_expression_.md#isostring) 30 | * [ParamKV](_expression_.md#paramkv) 31 | * [ParamsType](_expression_.md#paramstype) 32 | * [RangeOptions](_expression_.md#rangeoptions) 33 | * [RangeSettings](_expression_.md#rangesettings) 34 | * [RangeValue](_expression_.md#rangevalue) 35 | * [SortOpts](_expression_.md#sortopts) 36 | * [SourceField](_expression_.md#sourcefield) 37 | * [TermField](_expression_.md#termfield) 38 | * [TermValue](_expression_.md#termvalue) 39 | * [TermsOptions](_expression_.md#termsoptions) 40 | 41 | ## Type aliases 42 | 43 | ### BoolOptions 44 | 45 | Ƭ **BoolOptions**: *object* 46 | 47 | *Defined in [expression.ts:200](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L200)* 48 | 49 | #### Type declaration: 50 | 51 | * **boost**? : *any* 52 | 53 | * **disable_coord**? : *any* 54 | 55 | * **filter**? : *[Nullable](_types_.md#nullable)‹[Expression](../classes/_expression_.expression.md)[]› | [Expression](../classes/_expression_.expression.md)* 56 | 57 | * **mininum_should_match**? : *any* 58 | 59 | * **must**? : *[Nullable](_types_.md#nullable)‹[Expression](../classes/_expression_.expression.md)[]›* 60 | 61 | * **must_not**? : *[Nullable](_types_.md#nullable)‹[Expression](../classes/_expression_.expression.md)[]›* 62 | 63 | * **should**? : *[Nullable](_types_.md#nullable)‹[Expression](../classes/_expression_.expression.md)[]›* 64 | 65 | ___ 66 | 67 | ### FieldQueryValue 68 | 69 | Ƭ **FieldQueryValue**: *string | number | boolean | null* 70 | 71 | *Defined in [expression.ts:114](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L114)* 72 | 73 | ___ 74 | 75 | ### ISOString 76 | 77 | Ƭ **ISOString**: *string* 78 | 79 | *Defined in [expression.ts:165](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L165)* 80 | 81 | ___ 82 | 83 | ### ParamKV 84 | 85 | Ƭ **ParamKV**: *[string, any]* 86 | 87 | *Defined in [expression.ts:25](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L25)* 88 | 89 | ___ 90 | 91 | ### ParamsType 92 | 93 | Ƭ **ParamsType**: *[Dictionary](_types_.md#dictionary)‹any, any›* 94 | 95 | *Defined in [expression.ts:23](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L23)* 96 | 97 | ___ 98 | 99 | ### RangeOptions 100 | 101 | Ƭ **RangeOptions**: *object* 102 | 103 | *Defined in [expression.ts:168](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L168)* 104 | 105 | #### Type declaration: 106 | 107 | * **from**? : *[RangeValue](_expression_.md#rangevalue)* 108 | 109 | * **gt**? : *[RangeValue](_expression_.md#rangevalue)* 110 | 111 | * **gte**? : *[RangeValue](_expression_.md#rangevalue)* 112 | 113 | * **include_lower**? : *undefined | false | true* 114 | 115 | * **include_upper**? : *undefined | false | true* 116 | 117 | * **lt**? : *[RangeValue](_expression_.md#rangevalue)* 118 | 119 | * **lte**? : *[RangeValue](_expression_.md#rangevalue)* 120 | 121 | * **to**? : *[RangeValue](_expression_.md#rangevalue)* 122 | 123 | ___ 124 | 125 | ### RangeSettings 126 | 127 | Ƭ **RangeSettings**: *object* 128 | 129 | *Defined in [expression.ts:179](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L179)* 130 | 131 | #### Type declaration: 132 | 133 | * **cache**? : *undefined | string* 134 | 135 | * **cacheKey**? : *undefined | string* 136 | 137 | * **execution**? : *any* 138 | 139 | * **name**? : *undefined | string* 140 | 141 | ___ 142 | 143 | ### RangeValue 144 | 145 | Ƭ **RangeValue**: *number | string | Date | [ISOString](_expression_.md#isostring)* 146 | 147 | *Defined in [expression.ts:166](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L166)* 148 | 149 | ___ 150 | 151 | ### SortOpts 152 | 153 | Ƭ **SortOpts**: *object* 154 | 155 | *Defined in [expression.ts:236](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L236)* 156 | 157 | #### Type declaration: 158 | 159 | * **ignore_unmapped**? : *any* 160 | 161 | * **missing**? : *any* 162 | 163 | * **mode**? : *any* 164 | 165 | * **nested_filter**? : *any* 166 | 167 | * **nested_path**? : *any* 168 | 169 | ___ 170 | 171 | ### SourceField 172 | 173 | Ƭ **SourceField**: *boolean | string | [Field](../classes/_document_.field.md) | null* 174 | 175 | *Defined in [expression.ts:77](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L77)* 176 | 177 | ___ 178 | 179 | ### TermField 180 | 181 | Ƭ **TermField**: *[Dictionary](_types_.md#dictionary)‹string, [TermValue](_expression_.md#termvalue)›* 182 | 183 | *Defined in [expression.ts:10](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L10)* 184 | 185 | ___ 186 | 187 | ### TermValue 188 | 189 | Ƭ **TermValue**: *number | string | boolean* 190 | 191 | *Defined in [expression.ts:6](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L6)* 192 | 193 | ___ 194 | 195 | ### TermsOptions 196 | 197 | Ƭ **TermsOptions**: *object* 198 | 199 | *Defined in [expression.ts:148](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/expression.ts#L148)* 200 | 201 | #### Type declaration: 202 | 203 | * **boost**? : *any* 204 | 205 | * **mininum_should_match**? : *any* 206 | -------------------------------------------------------------------------------- /website/docs/api/modules/_index_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_index_" 3 | title: "index" 4 | sidebar_label: "index" 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /website/docs/api/modules/_result_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_result_" 3 | title: "result" 4 | sidebar_label: "result" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Classes 10 | 11 | * [Result](../classes/_result_.result.md) 12 | * [SearchResult](../classes/_result_.searchresult.md) 13 | 14 | ### Type aliases 15 | 16 | * [InstanceMapperDict](_result_.md#instancemapperdict) 17 | 18 | ### Variables 19 | 20 | * [DOC_TYPE_FIELD](_result_.md#const-doc_type_field) 21 | * [DOC_TYPE_NAME_FIELD](_result_.md#const-doc_type_name_field) 22 | 23 | ### Functions 24 | 25 | * [docClsMap](_result_.md#docclsmap) 26 | * [getDocTypeForHit](_result_.md#getdoctypeforhit) 27 | * [isInstanceMapperDict](_result_.md#isinstancemapperdict) 28 | 29 | ## Type aliases 30 | 31 | ### InstanceMapperDict 32 | 33 | Ƭ **InstanceMapperDict**: *[Dictionary](_types_.md#dictionary)‹string, [InstanceMapper](_search_.md#instancemapper)‹any››* 34 | 35 | *Defined in [result.ts:25](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L25)* 36 | 37 | ## Variables 38 | 39 | ### `Const` DOC_TYPE_FIELD 40 | 41 | • **DOC_TYPE_FIELD**: *"_doc_type"* = "_doc_type" 42 | 43 | *Defined in [result.ts:8](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L8)* 44 | 45 | ___ 46 | 47 | ### `Const` DOC_TYPE_NAME_FIELD 48 | 49 | • **DOC_TYPE_NAME_FIELD**: *string* = `${DOC_TYPE_FIELD}.name` 50 | 51 | *Defined in [result.ts:9](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L9)* 52 | 53 | ## Functions 54 | 55 | ### docClsMap 56 | 57 | ▸ **docClsMap**(`docClasses`: Readonly‹[DocClass](_document_.md#docclass)[]›): *[Dictionary](_types_.md#dictionary)‹string, [DocClass](_document_.md#docclass)›* 58 | 59 | *Defined in [result.ts:11](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L11)* 60 | 61 | **Parameters:** 62 | 63 | Name | Type | 64 | ------ | ------ | 65 | `docClasses` | Readonly‹[DocClass](_document_.md#docclass)[]› | 66 | 67 | **Returns:** *[Dictionary](_types_.md#dictionary)‹string, [DocClass](_document_.md#docclass)›* 68 | 69 | ___ 70 | 71 | ### getDocTypeForHit 72 | 73 | ▸ **getDocTypeForHit**(`hit`: [Hit](_types_.md#hit)): *string* 74 | 75 | *Defined in [result.ts:19](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L19)* 76 | 77 | **Parameters:** 78 | 79 | Name | Type | 80 | ------ | ------ | 81 | `hit` | [Hit](_types_.md#hit) | 82 | 83 | **Returns:** *string* 84 | 85 | ___ 86 | 87 | ### isInstanceMapperDict 88 | 89 | ▸ **isInstanceMapperDict**(`arg`: any): *arg is InstanceMapperDict* 90 | 91 | *Defined in [result.ts:27](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/result.ts#L27)* 92 | 93 | **Parameters:** 94 | 95 | Name | Type | 96 | ------ | ------ | 97 | `arg` | any | 98 | 99 | **Returns:** *arg is InstanceMapperDict* 100 | -------------------------------------------------------------------------------- /website/docs/api/modules/_types_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_types_" 3 | title: "types" 4 | sidebar_label: "types" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Type aliases 10 | 11 | * [BucketFields](_types_.md#bucketfields) 12 | * [Dictionary](_types_.md#dictionary) 13 | * [Hit](_types_.md#hit) 14 | * [KVList](_types_.md#kvlist) 15 | * [Nullable](_types_.md#nullable) 16 | * [PlainObject](_types_.md#plainobject) 17 | * [RawAgg](_types_.md#rawagg) 18 | * [RawAggBucket](_types_.md#rawaggbucket) 19 | * [RawAggBucketChild](_types_.md#rawaggbucketchild) 20 | * [RawAggs](_types_.md#rawaggs) 21 | * [RawResultBody](_types_.md#rawresultbody) 22 | * [SearchResponseBody](_types_.md#searchresponsebody) 23 | 24 | ### Functions 25 | 26 | * [isPlainObject](_types_.md#isplainobject) 27 | 28 | ## Type aliases 29 | 30 | ### BucketFields 31 | 32 | Ƭ **BucketFields**: *object* 33 | 34 | *Defined in [types.ts:25](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L25)* 35 | 36 | #### Type declaration: 37 | 38 | * **doc_count**: *number* 39 | 40 | ___ 41 | 42 | ### Dictionary 43 | 44 | Ƭ **Dictionary**: *object* 45 | 46 | *Defined in [types.ts:3](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L3)* 47 | 48 | #### Type declaration: 49 | 50 | ___ 51 | 52 | ### Hit 53 | 54 | Ƭ **Hit**: *object* 55 | 56 | *Defined in [types.ts:15](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L15)* 57 | 58 | #### Type declaration: 59 | 60 | * **_id**: *string* 61 | 62 | * **_index**? : *undefined | string* 63 | 64 | * **_routing**? : *undefined | string* 65 | 66 | * **_score**? : *undefined | number* 67 | 68 | * **_source**? : *T* 69 | 70 | * **_type**? : *undefined | string* 71 | 72 | * **fields**? : *[PlainObject](_types_.md#plainobject)* 73 | 74 | ___ 75 | 76 | ### KVList 77 | 78 | Ƭ **KVList**: *[T1, T2]* 79 | 80 | *Defined in [types.ts:6](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L6)* 81 | 82 | ___ 83 | 84 | ### Nullable 85 | 86 | Ƭ **Nullable**: *T | null | undefined* 87 | 88 | *Defined in [types.ts:1](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L1)* 89 | 90 | ___ 91 | 92 | ### PlainObject 93 | 94 | Ƭ **PlainObject**: *object* 95 | 96 | *Defined in [types.ts:8](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L8)* 97 | 98 | #### Type declaration: 99 | 100 | * \[ **name**: *string*\]: any 101 | 102 | ___ 103 | 104 | ### RawAgg 105 | 106 | Ƭ **RawAgg**: *object* 107 | 108 | *Defined in [types.ts:34](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L34)* 109 | 110 | #### Type declaration: 111 | 112 | * **buckets**: *[RawAggBucket](_types_.md#rawaggbucket)[]* 113 | 114 | * **doc_count_error_upper_bound**: *number* 115 | 116 | * **sum_other_doc_count**: *number* 117 | 118 | ___ 119 | 120 | ### RawAggBucket 121 | 122 | Ƭ **RawAggBucket**: *object & [RawAggBucketChild](_types_.md#rawaggbucketchild)* 123 | 124 | *Defined in [types.ts:29](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L29)* 125 | 126 | ___ 127 | 128 | ### RawAggBucketChild 129 | 130 | Ƭ **RawAggBucketChild**: *[Dictionary](_types_.md#dictionary)‹string, [BucketFields](_types_.md#bucketfields) | [Dictionary](_types_.md#dictionary)‹string, [BucketFields](_types_.md#bucketfields)››* 131 | 132 | *Defined in [types.ts:27](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L27)* 133 | 134 | ___ 135 | 136 | ### RawAggs 137 | 138 | Ƭ **RawAggs**: *[Dictionary](_types_.md#dictionary)‹string, [RawAgg](_types_.md#rawagg)›* 139 | 140 | *Defined in [types.ts:39](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L39)* 141 | 142 | ___ 143 | 144 | ### RawResultBody 145 | 146 | Ƭ **RawResultBody**: *[SearchResponseBody](_types_.md#searchresponsebody)‹T›* 147 | 148 | *Defined in [types.ts:60](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L60)* 149 | 150 | ___ 151 | 152 | ### SearchResponseBody 153 | 154 | Ƭ **SearchResponseBody**: *object* 155 | 156 | *Defined in [types.ts:41](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L41)* 157 | 158 | #### Type declaration: 159 | 160 | * **_scroll_id**? : *undefined | number* 161 | 162 | * **_shards**(): *object* 163 | 164 | * **failed**: *number* 165 | 166 | * **skipped**: *number* 167 | 168 | * **successful**: *number* 169 | 170 | * **total**: *number* 171 | 172 | * **aggregations**? : *[RawAggs](_types_.md#rawaggs)* 173 | 174 | * **error**? : *undefined | string* 175 | 176 | * **hits**(): *object* 177 | 178 | * **hits**: *Array‹[Hit](_types_.md#hit)‹T››* 179 | 180 | * **max_score**: *number* 181 | 182 | * **total**: *number* 183 | 184 | * **timed_out**: *boolean* 185 | 186 | * **took**: *number* 187 | 188 | ## Functions 189 | 190 | ### isPlainObject 191 | 192 | ▸ **isPlainObject**(`obj`: any): *obj is PlainObject* 193 | 194 | *Defined in [types.ts:10](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/types.ts#L10)* 195 | 196 | **Parameters:** 197 | 198 | Name | Type | 199 | ------ | ------ | 200 | `obj` | any | 201 | 202 | **Returns:** *obj is PlainObject* 203 | -------------------------------------------------------------------------------- /website/docs/api/modules/_util_.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: "_util_" 3 | title: "util" 4 | sidebar_label: "util" 5 | --- 6 | 7 | ## Index 8 | 9 | ### Functions 10 | 11 | * [arrayKVToDict](_util_.md#arraykvtodict) 12 | * [cleanParams](_util_.md#cleanparams) 13 | * [collectDocClasses](_util_.md#collectdocclasses) 14 | * [flatMap](_util_.md#flatmap) 15 | * [isArray](_util_.md#isarray) 16 | * [isBoolean](_util_.md#isboolean) 17 | * [isExpression](_util_.md#isexpression) 18 | * [isNullOrUndef](_util_.md#isnullorundef) 19 | * [isObject](_util_.md#isobject) 20 | * [isString](_util_.md#isstring) 21 | * [mergeParams](_util_.md#mergeparams) 22 | * [mustClean](_util_.md#mustclean) 23 | * [uniqueArray](_util_.md#uniquearray) 24 | 25 | ## Functions 26 | 27 | ### arrayKVToDict 28 | 29 | ▸ **arrayKVToDict**<**T**>(`array`: any[][]): *T* 30 | 31 | *Defined in [util.ts:5](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L5)* 32 | 33 | **Type parameters:** 34 | 35 | ▪ **T** 36 | 37 | **Parameters:** 38 | 39 | Name | Type | 40 | ------ | ------ | 41 | `array` | any[][] | 42 | 43 | **Returns:** *T* 44 | 45 | ___ 46 | 47 | ### cleanParams 48 | 49 | ▸ **cleanParams**(`params?`: [Nullable](_types_.md#nullable)‹[ParamsType](_expression_.md#paramstype)›): *[ParamsType](_expression_.md#paramstype)* 50 | 51 | *Defined in [util.ts:16](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L16)* 52 | 53 | TODO add tests 54 | Filter keys having null or undefined values 55 | 56 | **Parameters:** 57 | 58 | Name | Type | 59 | ------ | ------ | 60 | `params?` | [Nullable](_types_.md#nullable)‹[ParamsType](_expression_.md#paramstype)› | 61 | 62 | **Returns:** *[ParamsType](_expression_.md#paramstype)* 63 | 64 | ___ 65 | 66 | ### collectDocClasses 67 | 68 | ▸ **collectDocClasses**(`expr?`: [Expression](../classes/_expression_.expression.md) | [Expression](../classes/_expression_.expression.md)[] | [ParamsType](_expression_.md#paramstype) | [FieldQueryValue](_expression_.md#fieldqueryvalue)): *Readonly‹[DocClass](_document_.md#docclass)[]›* 69 | 70 | *Defined in [util.ts:55](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L55)* 71 | 72 | **Parameters:** 73 | 74 | Name | Type | 75 | ------ | ------ | 76 | `expr?` | [Expression](../classes/_expression_.expression.md) | [Expression](../classes/_expression_.expression.md)[] | [ParamsType](_expression_.md#paramstype) | [FieldQueryValue](_expression_.md#fieldqueryvalue) | 77 | 78 | **Returns:** *Readonly‹[DocClass](_document_.md#docclass)[]›* 79 | 80 | ___ 81 | 82 | ### flatMap 83 | 84 | ▸ **flatMap**(`f`: function, `arr`: any[]): *any[]* 85 | 86 | *Defined in [util.ts:77](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L77)* 87 | 88 | **Parameters:** 89 | 90 | ▪ **f**: *function* 91 | 92 | ▸ (`arg`: any): *any* 93 | 94 | **Parameters:** 95 | 96 | Name | Type | 97 | ------ | ------ | 98 | `arg` | any | 99 | 100 | ▪ **arr**: *any[]* 101 | 102 | **Returns:** *any[]* 103 | 104 | ___ 105 | 106 | ### isArray 107 | 108 | ▸ **isArray**<**T**>(`x`: any): *x is T[]* 109 | 110 | *Defined in [util.ts:28](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L28)* 111 | 112 | **Type parameters:** 113 | 114 | ▪ **T** 115 | 116 | **Parameters:** 117 | 118 | Name | Type | 119 | ------ | ------ | 120 | `x` | any | 121 | 122 | **Returns:** *x is T[]* 123 | 124 | ___ 125 | 126 | ### isBoolean 127 | 128 | ▸ **isBoolean**(`x`: any): *x is boolean* 129 | 130 | *Defined in [util.ts:36](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L36)* 131 | 132 | **Parameters:** 133 | 134 | Name | Type | 135 | ------ | ------ | 136 | `x` | any | 137 | 138 | **Returns:** *x is boolean* 139 | 140 | ___ 141 | 142 | ### isExpression 143 | 144 | ▸ **isExpression**(`x`: any): *x is Expression* 145 | 146 | *Defined in [util.ts:44](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L44)* 147 | 148 | **Parameters:** 149 | 150 | Name | Type | 151 | ------ | ------ | 152 | `x` | any | 153 | 154 | **Returns:** *x is Expression* 155 | 156 | ___ 157 | 158 | ### isNullOrUndef 159 | 160 | ▸ **isNullOrUndef**(`x`: any): *x is null | undefined* 161 | 162 | *Defined in [util.ts:48](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L48)* 163 | 164 | **Parameters:** 165 | 166 | Name | Type | 167 | ------ | ------ | 168 | `x` | any | 169 | 170 | **Returns:** *x is null | undefined* 171 | 172 | ___ 173 | 174 | ### isObject 175 | 176 | ▸ **isObject**(`x`: any): *x is object* 177 | 178 | *Defined in [util.ts:40](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L40)* 179 | 180 | **Parameters:** 181 | 182 | Name | Type | 183 | ------ | ------ | 184 | `x` | any | 185 | 186 | **Returns:** *x is object* 187 | 188 | ___ 189 | 190 | ### isString 191 | 192 | ▸ **isString**(`x`: any): *x is string* 193 | 194 | *Defined in [util.ts:32](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L32)* 195 | 196 | **Parameters:** 197 | 198 | Name | Type | 199 | ------ | ------ | 200 | `x` | any | 201 | 202 | **Returns:** *x is string* 203 | 204 | ___ 205 | 206 | ### mergeParams 207 | 208 | ▸ **mergeParams**(`currentParams`: [Params](../classes/_expression_.params.md), `newParams`: [Params](../classes/_expression_.params.md)): *[Params](../classes/_expression_.params.md)* 209 | 210 | *Defined in [util.ts:73](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L73)* 211 | 212 | **Parameters:** 213 | 214 | Name | Type | 215 | ------ | ------ | 216 | `currentParams` | [Params](../classes/_expression_.params.md) | 217 | `newParams` | [Params](../classes/_expression_.params.md) | 218 | 219 | **Returns:** *[Params](../classes/_expression_.params.md)* 220 | 221 | ___ 222 | 223 | ### mustClean 224 | 225 | ▸ **mustClean**(`arg`: any[] | [Nullable](_types_.md#nullable)): *boolean* 226 | 227 | *Defined in [util.ts:81](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L81)* 228 | 229 | **Parameters:** 230 | 231 | Name | Type | 232 | ------ | ------ | 233 | `arg` | any[] | [Nullable](_types_.md#nullable) | 234 | 235 | **Returns:** *boolean* 236 | 237 | ___ 238 | 239 | ### uniqueArray 240 | 241 | ▸ **uniqueArray**<**T**>(`items`: T[]): *T[]* 242 | 243 | *Defined in [util.ts:52](https://github.com/kindritskyiMax/elasticmagic-js/blob/34d4703/src/util.ts#L52)* 244 | 245 | **Type parameters:** 246 | 247 | ▪ **T** 248 | 249 | **Parameters:** 250 | 251 | Name | Type | 252 | ------ | ------ | 253 | `items` | T[] | 254 | 255 | **Returns:** *T[]* 256 | -------------------------------------------------------------------------------- /website/docs/getting_started.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: getting_started 3 | title: Getting started with Elasticmagic 4 | sidebar_label: Getting started with Elasticmagic 5 | --- 6 | 7 | Elasticmagic is a Elasticsearch query builder and ORM for JavaScript/Typescript. 8 | 9 | It helps you easily build queries which are typed and safe. 10 | 11 | You do not need to remember how to write `json` DSL for Elasticsearch, Elasticmagic will do it for you. 12 | 13 | ## Installation 14 | 15 | To install Elasticmagic via NPM: 16 | 17 | ```bash 18 | npm install --save elasticmagic 19 | ``` 20 | 21 | Also you need an Elasticseach official js client 22 | 23 | ```bash 24 | npm install --save @elastic/elasticsearch 25 | ``` 26 | 27 | ## Basic example 28 | 29 | ```javascript 30 | import { Client } from '@elastic/elasticsearch'; 31 | import { 32 | Cluster, 33 | Field, 34 | IntegerType, 35 | Doc, 36 | Bool, 37 | } from "elasticmagic-js"; 38 | 39 | 40 | /** 41 | * Here we creating our document which maps structure of same document in Elasticsearch. 42 | * 43 | * We will use this class as our query builder. 44 | * Also when we will get result from elasticsearch, we instantiate this class 45 | * and populate it with data from Elasticsearch hits. 46 | * 47 | * First we declare docType - it must be the same as document in Elasticsearch mapping. 48 | * 49 | * Then we declare static fields that will be user to build our queries. 50 | * As we do not need an instance of this class to build queries, the fields are static. 51 | * 52 | * Next, conventionaly, we declare instance properties, as you can see, with almost same name. 53 | * Then lettercase is same as fields in Elasticseach mapping 54 | * 55 | * And thats is. 56 | */ 57 | class OrderDoc extends Doc { 58 | public static docType: string = 'order'; 59 | 60 | public static userId = new Field(IntegerType, 'user_id', OrderDoc); 61 | public user_id?: number; 62 | 63 | public static status = new Field(IntegerType, 'status', OrderDoc); 64 | public status?: number; 65 | 66 | public static source = new Field(IntegerType, 'source', OrderDoc); 67 | public source?: number; 68 | 69 | public static price = new Field(IntegerType, 'price', OrderDoc); 70 | public price?: number; 71 | 72 | public static dateCreated = new Field(DateType, 'date_created', OrderDoc); 73 | public date_created?: Date; 74 | } 75 | 76 | // Create a Elasticsearch client which will be passed to cluster. 77 | const client = new Client({ node: 'http://es6-test:9200' }); 78 | // Create cluster instance. Its an entrypiint for interacting with Elasticsearch. 79 | const cluster = new Cluster(client, 'test_order_index'); 80 | 81 | 82 | // Lets start building our query. 83 | // Calling searchQuery method we start creating new query. 84 | // We using builder pattern, so you can chain any amount of methods 85 | const query = cluster.searchQuery({ routing: 1 }) 86 | .source(true) 87 | .filter( 88 | Bool.must( 89 | OrderDoc.userId.in([1]), 90 | OrderDoc.status.in([1, 2]), 91 | OrderDoc.source.not(1), 92 | OrderDoc.dateCreated.lte(new Date().toISOString()) 93 | ) 94 | ); 95 | 96 | // To make a query to Elasticsearch we calling getResult. 97 | const result = await query.getResult(); 98 | console.log(result.getIds()); // prints ["1"] 99 | 100 | const hit = result.hits[0]; 101 | console.log(hit.user_id); // prints 1 102 | ``` 103 | 104 | We can check what query Elasticmagic will build for us. 105 | 106 | ```javascript 107 | console.log(query.toJSON()) 108 | // to see prettified query 109 | console.log(query.toPrettyJSON()); 110 | ``` -------------------------------------------------------------------------------- /website/docs/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: installation 3 | title: Installation 4 | --- 5 | 6 | To install Elasticmagic via NPM: 7 | 8 | ```bash 9 | npm install --save elasticmagic 10 | ``` 11 | 12 | Also you need an Elasticseach official js client 13 | 14 | ```bash 15 | npm install --save @elastic/elasticsearch 16 | ``` -------------------------------------------------------------------------------- /website/docs/instance_mapper.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: instance_mapper 3 | title: Instance mapper 4 | --- 5 | 6 | ## How it works 7 | 8 | It's possible to pass an async function which map ids from elasticsearch to structure definded by instance mapper function. 9 | 10 | When specifying `source(false)`, elasticsearch returns only _id of found document in `hit._source` field. 11 | 12 | Instance mapper is lazy by design and evaluated only when `getInstances` called `SearchResult` or `getInstance` called on `Doc` subtype 13 | 14 | ## Examples 15 | 16 | ```javascript 17 | 18 | const cluster = new Cluster(client, 'my_doc_index'); 19 | 20 | type EntityMapped = { 21 | id: number; 22 | name: string; 23 | status: number; 24 | createdAt: Date; 25 | } 26 | 27 | 28 | const query = cluster.searchQuery() 29 | .filter(MyDoc.status.eq(1)) 30 | .source(false) 31 | .withInstanceMapper(async (ids: string[]): Map => { 32 | const entitiesFromDb = await dbConnection.select().whereIn('id', ids); 33 | // create entity id -> entity map 34 | const entitiesMap = new Map(entitiesFromDb.map((entity) => [entity.id, entity])); 35 | // suppose entity has fields id, name, status, createdAt 36 | return new Map(ids.map((id) => { 37 | const entity = entitiesMap.get(id); 38 | return [id, entity.toJSON()]; 39 | })); 40 | }); 41 | 42 | const result = await query.getResult(); 43 | 44 | // instances is an ordered list of objects returned by instance mapper 45 | const instances = await result.getInstances(); 46 | 47 | // or you can retreive instance from concrete hit 48 | const hit = result.hits[0]; 49 | const instance = await hit.getInstance(); 50 | ``` -------------------------------------------------------------------------------- /website/docusaurus.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'Elasticmagic', 3 | tagline: 'JavaScript/TypeScript ORM and query builder for Elasticsearch', 4 | url: 'https://elasticmagic.js.org', 5 | baseUrl: '/', 6 | favicon: 'img/favicon.ico', 7 | organizationName: 'kindritskyiMax', // Usually your GitHub org/user name. 8 | projectName: 'elasticmagic-js', // Usually your repo name. 9 | themeConfig: { 10 | navbar: { 11 | title: 'Elasticmagic', 12 | logo: { 13 | alt: 'Elasticmagic Logo', 14 | src: 'img/logo.svg', 15 | }, 16 | links: [ 17 | {to: 'docs/getting_started', label: 'Getting Started', position: 'right'}, 18 | {to: 'docs/api', label: 'API', position: 'right'}, 19 | {to: 'docs/faq', label: 'FAQ', position: 'right'}, 20 | { 21 | href: 'https://github.com/kindritskyiMax/elasticmagic-js', 22 | label: 'GitHub', 23 | position: 'right', 24 | }, 25 | ], 26 | }, 27 | footer: { 28 | style: 'dark', 29 | links: [ 30 | { 31 | title: 'Docs', 32 | items: [ 33 | { 34 | label: 'Getting Started', 35 | to: 'docs/getting_started', 36 | }, 37 | ], 38 | }, 39 | { 40 | title: 'Community', 41 | items: [ 42 | { 43 | label: 'Stack Overflow', 44 | href: 'https://stackoverflow.com/questions/tagged/elasticmagic-js', 45 | }, 46 | ], 47 | }, 48 | { 49 | title: 'Social', 50 | items: [ 51 | { 52 | label: 'Blog', 53 | to: 'blog', 54 | }, 55 | { 56 | label: 'GitHub', 57 | href: 'https://github.com/kindritskyiMax/elasticmagic-js', 58 | }, 59 | ], 60 | }, 61 | ], 62 | copyright: `Copyright © ${new Date().getFullYear()} Elasticmagic, Inc. Built with Docusaurus.`, 63 | }, 64 | }, 65 | presets: [ 66 | [ 67 | '@docusaurus/preset-classic', 68 | { 69 | docs: { 70 | sidebarPath: require.resolve('./sidebars.js'), 71 | editUrl: 72 | 'https://github.com/facebook/docusaurus/edit/master/website/', 73 | }, 74 | theme: { 75 | customCss: require.resolve('./src/css/custom.css'), 76 | }, 77 | }, 78 | ], 79 | ], 80 | }; 81 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "docusaurus start", 7 | "build": "docusaurus build", 8 | "swizzle": "docusaurus swizzle", 9 | "deploy": "docusaurus deploy" 10 | }, 11 | "dependencies": { 12 | "@docusaurus/core": "^2.0.0-alpha.40", 13 | "@docusaurus/preset-classic": "^2.0.0-alpha.40", 14 | "classnames": "^2.2.6", 15 | "react": "^16.8.4", 16 | "react-dom": "^16.8.4" 17 | }, 18 | "browserslist": { 19 | "production": [ 20 | ">0.2%", 21 | "not dead", 22 | "not op_mini all" 23 | ], 24 | "development": [ 25 | "last 1 chrome version", 26 | "last 1 firefox version", 27 | "last 1 safari version" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /website/sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | module.exports = { 9 | docs: { 10 | Introduction: [ 11 | 'getting_started', 12 | 'installation', 13 | 'querying', 14 | 'aggregations', 15 | 'instance_mapper', 16 | ], 17 | "API Reference": [ 18 | 'api', 19 | ], 20 | "API Modules": [ 21 | "api/modules/_agg_", 22 | "api/modules/_cluster_", 23 | "api/modules/_compiler_", 24 | "api/modules/_document_", 25 | "api/modules/_expression_", 26 | "api/modules/_index_", 27 | "api/modules/_result_", 28 | "api/modules/_search_", 29 | "api/modules/_types_", 30 | "api/modules/_util_", 31 | ], 32 | "API Classes": [ 33 | "api/classes/_agg_.aggexpression", 34 | "api/classes/_agg_.aggresult", 35 | "api/classes/_agg_.bucket", 36 | "api/classes/_agg_.bucketagg", 37 | "api/classes/_agg_.filter", 38 | "api/classes/_agg_.multibucketagg", 39 | "api/classes/_agg_.multibucketaggresult", 40 | "api/classes/_agg_.singlebucketagg", 41 | "api/classes/_agg_.singlebucketaggresult", 42 | "api/classes/_agg_.terms", 43 | "api/classes/_cluster_.cluster", 44 | "api/classes/_cluster_.esversion", 45 | "api/classes/_cluster_.index", 46 | "api/classes/_compiler_.compilervisitor", 47 | "api/classes/_document_.booleantype", 48 | "api/classes/_document_.datetype", 49 | "api/classes/_document_.doc", 50 | "api/classes/_document_.field", 51 | "api/classes/_document_.fieldtype", 52 | "api/classes/_document_.floattype", 53 | "api/classes/_document_.integertype", 54 | "api/classes/_document_.stringtype", 55 | "api/classes/_expression_.bool", 56 | "api/classes/_expression_.expression", 57 | "api/classes/_expression_.fieldexpression", 58 | "api/classes/_expression_.fieldqueryexpression", 59 | "api/classes/_expression_.literal", 60 | "api/classes/_expression_.params", 61 | "api/classes/_expression_.paramsexpression", 62 | "api/classes/_expression_.queryexpression", 63 | "api/classes/_expression_.rangeexpr", 64 | "api/classes/_expression_.sort", 65 | "api/classes/_expression_.source", 66 | "api/classes/_expression_.term", 67 | "api/classes/_expression_.terms", 68 | "api/classes/_result_.result", 69 | "api/classes/_result_.searchresult", 70 | "api/classes/_search_.searchquery", 71 | "api/classes/_search_.searchquerycontext", 72 | "api/classes/_agg_.aggexpression", 73 | "api/classes/_agg_.aggresult", 74 | "api/classes/_agg_.bucket", 75 | "api/classes/_agg_.bucketagg", 76 | "api/classes/_agg_.filter", 77 | "api/classes/_agg_.multibucketagg", 78 | "api/classes/_agg_.multibucketaggresult", 79 | "api/classes/_agg_.singlebucketagg", 80 | "api/classes/_agg_.singlebucketaggresult", 81 | "api/classes/_agg_.terms", 82 | "api/classes/_cluster_.cluster", 83 | "api/classes/_cluster_.esversion", 84 | "api/classes/_cluster_.index", 85 | "api/classes/_compiler_.compilervisitor", 86 | "api/classes/_document_.booleantype", 87 | "api/classes/_document_.datetype", 88 | "api/classes/_document_.doc", 89 | "api/classes/_document_.field", 90 | "api/classes/_document_.fieldtype", 91 | "api/classes/_document_.floattype", 92 | "api/classes/_document_.integertype", 93 | "api/classes/_document_.stringtype", 94 | "api/classes/_expression_.bool", 95 | "api/classes/_expression_.expression", 96 | "api/classes/_expression_.fieldexpression", 97 | "api/classes/_expression_.fieldqueryexpression", 98 | "api/classes/_expression_.literal", 99 | "api/classes/_expression_.params", 100 | "api/classes/_expression_.paramsexpression", 101 | "api/classes/_expression_.queryexpression", 102 | "api/classes/_expression_.rangeexpr", 103 | "api/classes/_expression_.sort", 104 | "api/classes/_expression_.source", 105 | "api/classes/_expression_.term", 106 | "api/classes/_expression_.terms", 107 | "api/classes/_result_.result", 108 | "api/classes/_result_.searchresult", 109 | "api/classes/_search_.searchquery", 110 | "api/classes/_search_.searchquerycontext" 111 | ], 112 | Changelog: [ 113 | 'changelog', 114 | ], 115 | }, 116 | }; 117 | -------------------------------------------------------------------------------- /website/src/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Any CSS included here will be global. The classic template 3 | * bundles Infima by default. Infima is a CSS framework designed to 4 | * work well for content-centric websites. 5 | */ 6 | 7 | /* You can override the default Infima variables here. */ 8 | :root { 9 | --ifm-color-primary: #25c2a0; 10 | --ifm-color-primary-dark: rgb(33, 175, 144); 11 | --ifm-color-primary-darker: rgb(31, 165, 136); 12 | --ifm-color-primary-darkest: rgb(26, 136, 112); 13 | --ifm-color-primary-light: rgb(70, 203, 174); 14 | --ifm-color-primary-lighter: rgb(102, 212, 189); 15 | --ifm-color-primary-lightest: rgb(146, 224, 208); 16 | --ifm-code-font-size: 95%; 17 | } 18 | 19 | .docusaurus-highlight-code-line { 20 | background-color: rgb(72, 77, 91); 21 | display: block; 22 | margin: 0 calc(-1 * var(--ifm-pre-padding)); 23 | padding: 0 var(--ifm-pre-padding); 24 | } 25 | -------------------------------------------------------------------------------- /website/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import classnames from 'classnames'; 3 | import Layout from '@theme/Layout'; 4 | import Link from '@docusaurus/Link'; 5 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 6 | import useBaseUrl from '@docusaurus/useBaseUrl'; 7 | import styles from './styles.module.css'; 8 | 9 | const features = [ 10 | { 11 | title: <>Easy to Use, 12 | description: ( 13 | <> 14 | Elasticmagic was designed to give an easy, safe and robust way to work with Elasticsearch. 15 | 16 | ), 17 | }, 18 | { 19 | title: <>Less to Learn, 20 | description: ( 21 | <> 22 | Elasticmagic lets you focus on your business logic. You do not need to remember and write raw Json DSL. 23 | 24 | ), 25 | }, 26 | { 27 | title: <>Safety, 28 | description: ( 29 | <> 30 | Elasticmagic written in Typescript which gives roubustnes and safety of the library. 31 | 32 | ), 33 | }, 34 | ]; 35 | 36 | function Feature({imageUrl, title, description}) { 37 | const imgUrl = useBaseUrl(imageUrl); 38 | return ( 39 |
40 | {imgUrl && ( 41 |
42 | {title} 43 |
44 | )} 45 |

{title}

46 |

{description}

47 |
48 | ); 49 | } 50 | 51 | function Home() { 52 | const context = useDocusaurusContext(); 53 | const {siteConfig = {}} = context; 54 | return ( 55 | 58 |
59 |
60 |

{siteConfig.title}

61 |

{siteConfig.tagline}

62 |
63 | 69 | Get Started 70 | 71 |
72 |
73 |
74 |
75 | {features && features.length && ( 76 |
77 |
78 |
79 | {features.map((props, idx) => ( 80 | 81 | ))} 82 |
83 |
84 |
85 | )} 86 |
87 |
88 | ); 89 | } 90 | 91 | export default Home; 92 | -------------------------------------------------------------------------------- /website/src/pages/styles.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 966px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | 25 | .features { 26 | display: flex; 27 | align-items: center; 28 | padding: 2rem 0; 29 | width: 100%; 30 | } 31 | 32 | .featureImage { 33 | height: 200px; 34 | width: 200px; 35 | } 36 | -------------------------------------------------------------------------------- /website/static/CNAME: -------------------------------------------------------------------------------- 1 | elasticmagic.js.org 2 | -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kindermax/elasticmagic-js/adeeab46e9d697f2e245673efcccf4e87c46778b/website/static/img/favicon.ico -------------------------------------------------------------------------------- /website/static/img/logo.svg: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------