diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b3f49c9a8c..484334ea24 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9005,7 +9005,7 @@ packages: dev: false file:projects/elastic.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-TJMFjRCKTFiVvTUmHZXH2Z6dFAqMiQiXrvRr33eIqL8/x3a8a3qXGfcoXUoC1tjPUPOLqU9lqxTcXBJDLPwKrg==, tarball: file:projects/elastic.tgz} + resolution: {integrity: sha512-ywnrb5JlC7rhYSRd+y+/YNf4qa61yvKdCuNb/ziAhTvk12tMUjUP/Hsek+HU2G74wsnF9CPq485JMfPmj+yWXQ==, tarball: file:projects/elastic.tgz} id: file:projects/elastic.tgz name: '@rush-temp/elastic' version: 0.0.0 @@ -9017,7 +9017,11 @@ packages: eslint-plugin-import: 2.23.4_eslint@7.32.0 eslint-plugin-node: 11.1.0_eslint@7.32.0 eslint-plugin-promise: 4.3.1 + ts-node: 10.2.1_typescript@4.3.5 transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - '@types/node' - '@typescript-eslint/parser' - supports-color - typescript @@ -9576,7 +9580,7 @@ packages: dev: false file:projects/server.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-IXKKQtFZQA5Vw1Asc9H0qvs+4iwYCSXt8ozTaZ55xEg5CeMO9mE8sAVbTWA6TxP/4T+HRQMbzrI7LtwPgWI9xw==, tarball: file:projects/server.tgz} + resolution: {integrity: sha512-6XfixxRO1uisszjaBtMFoQCCvv2zWAknPVz3ZmES4q/keIWZuDDP667FpDMJ9maBB1AN7ImI9VBMXNbXDlVUuA==, tarball: file:projects/server.tgz} id: file:projects/server.tgz name: '@rush-temp/server' version: 0.0.0 @@ -9841,7 +9845,7 @@ packages: dev: false file:projects/workspace.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-LyUaHX4Kqn0fMCMfSsN4nIqIFtRzbRruDdSv5bfyefDF4WUfrYUdy8IUwuWuwmq5NTr49jLg9oLCyAJZ059Ong==, tarball: file:projects/workspace.tgz} + resolution: {integrity: sha512-q2/1LqGkYRwsMNbjDjy4ngJlBDAefFWXuEdVyIN0DyBjmBibnEVZuQayjBh5O7xUQYKlT0A7TdVn99hpIwixOA==, tarball: file:projects/workspace.tgz} id: file:projects/workspace.tgz name: '@rush-temp/workspace' version: 0.0.0 @@ -9854,10 +9858,11 @@ packages: eslint-plugin-node: 11.1.0_eslint@7.32.0 eslint-plugin-promise: 4.3.1 mongodb: 4.1.0 - ts-node: 10.2.1_f50b86b1778cd2aa4e5405c08bb39559 + ts-node: 10.2.1_typescript@4.3.5 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' + - '@types/node' - '@typescript-eslint/parser' - supports-color - typescript diff --git a/server/elastic/package.json b/server/elastic/package.json index 1168dab7d0..0e92654cab 100644 --- a/server/elastic/package.json +++ b/server/elastic/package.json @@ -5,6 +5,7 @@ "author": "Anticrm Platform Contributors", "license": "EPL-2.0", "scripts": { + "init": "ts-node src/__init.ts", "build": "heft build", "lint:fix": "eslint --fix src" }, @@ -15,7 +16,8 @@ "eslint-plugin-import":"2", "eslint-plugin-promise":"4", "eslint-plugin-node":"11", - "eslint":"^7.32.0" + "eslint":"^7.32.0", + "ts-node":"^10.2.1" }, "dependencies": { "@anticrm/core": "~0.6.11", diff --git a/server/elastic/src/__init.ts b/server/elastic/src/__init.ts new file mode 100644 index 0000000000..dfff87370b --- /dev/null +++ b/server/elastic/src/__init.ts @@ -0,0 +1,66 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Client } from '@elastic/elasticsearch' + + +const url = process.env.ELASTIC_URL +if (url === undefined) { + console.error('please provide elastic url.') + process.exit(1) +} + +const client = new Client({node: 'http://45.32.149.163:9200/'}) + +client.ingest.putPipeline({ + id: 'anticrm-pipeline', + body: { + "processors" : [ + { "attachment" : { "field" : "attachment" } }, + { "remove" : { "field" : "attachment" } } + ] + } +}) +.then(function () { + console.log("putPipeline Resolved"); + }) +.catch(function (error) { + console.log("putPipeline error: " + error) + }) + + + + +// // Create index +// client.create({index: 'pdfs', type: 'pdf', id: 'my-index-id', +// body: {description: 'Test pdf indexing'} +// }) +// .then(function () {console.log("Index created");}) +// .catch(function (error) {console.log(error);}) + +// var body = { +// anticrm_doc: { +// properties:{ +// title : {"type" : "keyword", "index" : "false"}, +// type : {"type" : "keyword", "index" : "false"}, +// "attachment.pdf" : {"type" : "keyword"} +// } +// } +// } + +// client.indices.putMapping({index:"pdfs", type:"pdf", body:body}) +// .then((response) => {addPipeline()}) +// .catch((error) => {console.log("putMapping error: " + error)}) \ No newline at end of file diff --git a/server/elastic/src/__tests__/adapter.test.ts b/server/elastic/src/__tests__/adapter.test.ts index 01493751e9..805c408ac7 100644 --- a/server/elastic/src/__tests__/adapter.test.ts +++ b/server/elastic/src/__tests__/adapter.test.ts @@ -14,26 +14,25 @@ // limitations under the License. // -// import type { Tx } from '@anticrm/core' - -// import * as txJson from './model.tx.json' - -// const txes = txJson as unknown as Tx[] +import type { Ref, Doc, Class, Obj, Account, Space } from '@anticrm/core' +import { createElasticAdapter } from '../adapter' describe('client', () => { it('should create document', async () => { - // const hierarchy = new Hierarchy() - // for (const tx of txes) hierarchy.tx(tx) - // const adapter = await createElasticAdapter(hierarchy, 'http://localhost:9200/', 'ws1') - // const txFactory = new TxFactory(core.account.System) - // const createTx = txFactory.createTxCreateDoc(core.class.Space, core.space.Model, { - // name: 'name', - // description: 'description', - // private: false, - // members: [] - // }) - // await adapter.tx(createTx) - // const spaces = await adapter.findAll(core.class.Space, {}) - // console.log(spaces) + const adapter = await createElasticAdapter('http://localhost:9200/', 'ws1') + await adapter.index({ + id: 'doc1' as Ref, + _class: 'class1' as Ref>, + modifiedBy: 'andrey' as Ref, + modifiedOn: 0, + space: 'space1' as Ref, + content: 'hey there!' + }) + const hits = await adapter.search({}) + console.log(hits) }) + + // it('should find document', async () => { + // const adapter = await createElasticAdapter('http://localhost:9200/', 'ws1') + // }) }) diff --git a/server/elastic/src/__tests__/model.tx.json b/server/elastic/src/__tests__/model.tx.json deleted file mode 100644 index 00d033c741..0000000000 --- a/server/elastic/src/__tests__/model.tx.json +++ /dev/null @@ -1,1165 +0,0 @@ -[ - { - "_id": "611d2d25131730f65a01979e", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Obj", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0 - } - }, - { - "_id": "611d2d25131730f65a01979f", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Doc", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Obj" - } - }, - { - "_id": "611d2d25131730f65a0197a0", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Type", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197a1", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:TypeString", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Type" - } - }, - { - "_id": "611d2d25131730f65a0197a2", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Attribute", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197a3", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Account", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197a4", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Space", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197a5", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Tx", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "tx", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197a6", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:TxCUD", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Tx" - } - }, - { - "_id": "611d2d25131730f65a0197a7", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:TxUpdateDoc", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:TxCUD" - } - }, - { - "_id": "611d2d25131730f65a0197a8", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:TxMixin", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:TxCUD" - } - }, - { - "_id": "611d2d25131730f65a0197a9", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:TxCreateDoc", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:TxCUD" - } - }, - { - "_id": "611d2d25131730f65a0197aa", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Class", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197ab", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "core:class:Mixin", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053653, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Class" - } - }, - { - "_id": "611d2d25131730f65a0197ac", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "view:class:Viewlet", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197ad", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "view:class:ViewletDescriptor", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197ae", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "view:mixin:AttributePresenter", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Class" - } - }, - { - "_id": "611d2d25131730f65a0197af", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "view:mixin:AttributeEditor", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Class" - } - }, - { - "_id": "611d2d25131730f65a0197b0", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053654, - "objectId": "core:class:TypeString", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "view:mixin:AttributeEditor", - "attributes": { - "editor": "view:component:StringEditor" - } - }, - { - "_id": "611d2d25131730f65a0197b1", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053654, - "objectId": "core:class:TypeString", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "view:mixin:AttributePresenter", - "attributes": { - "presenter": "view:component:StringPresenter" - } - }, - { - "_id": "611d2d25131730f65a0197b2", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "view:viewlet:Table", - "objectClass": "view:class:ViewletDescriptor", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "label": "Table", - "icon": "view:icon:Table", - "component": "view:component:TableView" - } - }, - { - "_id": "611d2d25131730f65a0197b3", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "workbench:mixin:SpaceView", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Class" - } - }, - { - "_id": "611d2d25131730f65a0197b4", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "workbench:class:Application", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197b5", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "contact:class:Contact", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "contact", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197b6", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "contact:class:Person", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "contact:class:Contact", - "label": "Person" - } - }, - { - "_id": "611d2d25131730f65a0197b7", - "objectId": "611d2d25131730f65a0197b8", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053448, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "firstName", - "label": "First name", - "attributeOf": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197b9", - "objectId": "611d2d25131730f65a0197ba", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053448, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "lastName", - "label": "Last name", - "attributeOf": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197bb", - "objectId": "611d2d25131730f65a0197bc", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053448, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "email", - "label": "Email", - "attributeOf": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197bd", - "objectId": "611d2d25131730f65a0197be", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053448, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "phone", - "label": "Phone", - "attributeOf": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197bf", - "objectId": "611d2d25131730f65a0197c0", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053448, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "city", - "label": "City", - "attributeOf": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197c1", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "contact:class:Employee", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "contact:class:Person" - } - }, - { - "_id": "611d2d25131730f65a0197c2", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "contact:class:Organization", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "contact:class:Contact" - } - }, - { - "_id": "611d2d25131730f65a0197c3", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "contact:space:Employee", - "objectClass": "core:class:Space", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "name": "Employees", - "description": "Employees", - "private": false, - "members": [] - } - }, - { - "_id": "611d2d25131730f65a0197c4", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053654, - "objectId": "contact:class:Person", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "view:mixin:AttributePresenter", - "attributes": { - "presenter": "contact:component:PersonPresenter" - } - }, - { - "_id": "611d2d25131730f65a0197c5", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "chunter:class:Comment", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "comment", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197c6", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "chunter:class:Backlink", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "chunter:class:Comment" - } - }, - { - "_id": "611d2d25131730f65a0197c7", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "chunter:class:Message", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "chunter", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197c8", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "chunter:class:Channel", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053654, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Space", - "label": "chunter:string:Channel", - "icon": "chunter:icon:Hashtag" - } - }, - { - "_id": "611d2d25131730f65a0197c9", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053655, - "objectId": "chunter:class:Channel", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "workbench:mixin:SpaceView", - "attributes": { - "view": { - "class": "chunter:class:Message" - } - } - }, - { - "_id": "611d2d25131730f65a0197ca", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "chunter:viewlet:Chat", - "objectClass": "view:class:ViewletDescriptor", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "label": "Chat", - "icon": "view:icon:Table", - "component": "chunter:component:ChannelView" - } - }, - { - "_id": "611d2d25131730f65a0197cb", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197cc", - "objectClass": "view:class:Viewlet", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "attachTo": "chunter:class:Message", - "descriptor": "chunter:viewlet:Chat", - "open": "X", - "config": {} - } - }, - { - "_id": "611d2d25131730f65a0197cd", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197ce", - "objectClass": "workbench:class:Application", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "label": "chunter:string:ApplicationLabelChunter", - "icon": "chunter:icon:Chunter", - "navigatorModel": { - "spaces": [ - { - "label": "chunter:string:Channels", - "spaceClass": "chunter:class:Channel", - "addSpaceLabel": "chunter:string:CreateChannel", - "createComponent": "chunter:component:CreateChannel" - } - ] - } - } - }, - { - "_id": "611d2d25131730f65a0197cf", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197d0", - "objectClass": "chunter:class:Channel", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "name": "general", - "description": "General Channel", - "private": false, - "members": [] - } - }, - { - "_id": "611d2d25131730f65a0197d1", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197d2", - "objectClass": "chunter:class:Channel", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "name": "random", - "description": "Random Talks", - "private": false, - "members": [] - } - }, - { - "_id": "611d2d25131730f65a0197d3", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "task:class:Task", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197d4", - "objectId": "611d2d25131730f65a0197d5", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053498, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "title", - "label": "Title", - "attributeOf": "task:class:Task" - } - }, - { - "_id": "611d2d25131730f65a0197d6", - "objectId": "611d2d25131730f65a0197d7", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053498, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "description", - "label": "Description", - "attributeOf": "task:class:Task" - } - }, - { - "_id": "611d2d25131730f65a0197d8", - "objectId": "611d2d25131730f65a0197d9", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053498, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "assignee", - "label": "Assignee", - "attributeOf": "task:class:Task" - } - }, - { - "_id": "611d2d25131730f65a0197da", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "task:class:Project", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Space", - "label": "Project", - "icon": "task:icon:Task" - } - }, - { - "_id": "611d2d25131730f65a0197db", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053655, - "objectId": "task:class:Project", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "workbench:mixin:SpaceView", - "attributes": { - "view": { - "class": "task:class:Task", - "createItemDialog": "task:component:CreateTask" - } - } - }, - { - "_id": "611d2d25131730f65a0197dc", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197dd", - "objectClass": "view:class:Viewlet", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "attachTo": "task:class:Task", - "descriptor": "view:viewlet:Table", - "open": "ZX", - "options": { - "lookup": { - "assignee": "contact:class:Employee" - } - }, - "config": [ - "title", - "$lookup.assignee" - ] - } - }, - { - "_id": "611d2d25131730f65a0197de", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197df", - "objectClass": "workbench:class:Application", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "label": "task:string:ApplicationLabelTask", - "icon": "task:icon:Task", - "navigatorModel": { - "spaces": [ - { - "label": "task:string:Projects", - "spaceClass": "task:class:Project", - "addSpaceLabel": "task:string:CreateProject", - "createComponent": "task:component:CreateProject" - } - ] - } - } - }, - { - "_id": "611d2d25131730f65a0197e0", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197e1", - "objectClass": "task:class:Project", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "name": "demo", - "description": "Demo Project", - "private": false, - "members": [] - } - }, - { - "_id": "611d2d25131730f65a0197e2", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "recruit:class:Applicant", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "recruit", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197e3", - "objectId": "611d2d25131730f65a0197e4", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053609, - "objectSpace": "core:space:Model", - "objectClass": "core:class:Attribute", - "attributes": { - "type": { - "_class": "core:class:TypeString" - }, - "name": "candidate", - "label": "Candidate", - "attributeOf": "recruit:class:Applicant" - } - }, - { - "_id": "611d2d25131730f65a0197e5", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "recruit:class:Candidate", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "contact:class:Person", - "label": "Candidate" - } - }, - { - "_id": "611d2d25131730f65a0197e6", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "recruit:class:Candidates", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Space", - "label": "recruit:string:CandidatePools", - "icon": "recruit:icon:RecruitApplication" - } - }, - { - "_id": "611d2d25131730f65a0197e7", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "recruit:class:Vacancy", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "kind": 0, - "extends": "core:class:Space", - "label": "recruit:string:Vacancy", - "icon": "recruit:icon:Vacancy" - } - }, - { - "_id": "611d2d25131730f65a0197e8", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053655, - "objectId": "recruit:class:Vacancy", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "workbench:mixin:SpaceView", - "attributes": { - "view": { - "class": "recruit:class:Applicant", - "createItemDialog": "recruit:component:CreateApplication" - } - } - }, - { - "_id": "611d2d25131730f65a0197e9", - "_class": "core:class:TxMixin", - "space": "core:space:Tx", - "modifiedBy": "core:account:System", - "modifiedOn": 1629302053655, - "objectId": "recruit:class:Candidates", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "mixin": "workbench:mixin:SpaceView", - "attributes": { - "view": { - "class": "recruit:class:Candidate", - "createItemDialog": "recruit:component:CreateCandidate" - } - } - }, - { - "_id": "611d2d25131730f65a0197ea", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197eb", - "objectClass": "workbench:class:Application", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "label": "recruit:string:RecruitApplication", - "icon": "recruit:icon:RecruitApplication", - "navigatorModel": { - "spaces": [ - { - "label": "recruit:string:Vacancies", - "spaceClass": "recruit:class:Vacancy", - "addSpaceLabel": "recruit:string:CreateVacancy", - "createComponent": "recruit:component:CreateVacancy" - }, - { - "label": "recruit:string:CandidatePools", - "spaceClass": "recruit:class:Candidates", - "addSpaceLabel": "recruit:string:CreateCandidates", - "createComponent": "recruit:component:CreateCandidates" - } - ] - } - } - }, - { - "_id": "611d2d25131730f65a0197ec", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "recruit:space:CandidatesPublic", - "objectClass": "recruit:class:Candidates", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "name": "public", - "description": "Public Candidates", - "private": false, - "members": [] - } - }, - { - "_id": "611d2d25131730f65a0197ed", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197ee", - "objectClass": "view:class:Viewlet", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "attachTo": "recruit:class:Candidate", - "descriptor": "view:viewlet:Table", - "open": "recruit:component:EditCandidate", - "config": [ - "", - "email", - "phone", - "city" - ] - } - }, - { - "_id": "611d2d25131730f65a0197ef", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197f0", - "objectClass": "view:class:Viewlet", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "attachTo": "recruit:class:Applicant", - "descriptor": "view:viewlet:Table", - "open": "recruit:component:EditCandidate", - "options": { - "lookup": { - "candidate": "recruit:class:Candidate" - } - }, - "config": [ - "$lookup.candidate", - "$lookup.candidate.email", - "$lookup.candidate.city" - ] - } - }, - { - "_id": "611d2d25131730f65a0197f1", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "server-core:class:Trigger", - "objectClass": "core:class:Class", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "domain": "model", - "kind": 0, - "extends": "core:class:Doc" - } - }, - { - "_id": "611d2d25131730f65a0197f2", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197f3", - "objectClass": "server-core:class:Trigger", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "trigger": "server-chunter:trigger:OnMessage" - } - }, - { - "_id": "611d2d25131730f65a0197f4", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197f5", - "objectClass": "contact:class:Employee", - "objectSpace": "contact:space:Employee", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "firstName": "Rosamund", - "lastName": "Chen", - "email": "rosamund@hc.engineering", - "phone": "+1 655 912 3424", - "city": "Mountain View" - } - }, - { - "_id": "611d2d25131730f65a0197f6", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197f7", - "objectClass": "core:class:Account", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "email": "rosamund@hc.engineering" - } - }, - { - "_id": "611d2d25131730f65a0197f8", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197f9", - "objectClass": "contact:class:Employee", - "objectSpace": "contact:space:Employee", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "firstName": "Elon", - "lastName": "Musk", - "email": "elon@hc.engineering", - "phone": "+1 655 843 3453", - "city": "Bel Air" - } - }, - { - "_id": "611d2d25131730f65a0197fa", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197fb", - "objectClass": "core:class:Account", - "objectSpace": "core:space:Model", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "email": "elon@hc.engineering" - } - }, - { - "_id": "611d2d25131730f65a0197fc", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197fd", - "objectClass": "recruit:class:Candidate", - "objectSpace": "recruit:space:CandidatesPublic", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "firstName": "Andrey", - "lastName": "P.", - "email": "andrey@hc.engineering", - "phone": "+1 646 667 6832", - "city": "Monte Carlo" - } - }, - { - "_id": "611d2d25131730f65a0197fe", - "_class": "core:class:TxCreateDoc", - "space": "core:space:Tx", - "objectId": "611d2d25131730f65a0197ff", - "objectClass": "recruit:class:Candidate", - "objectSpace": "recruit:space:CandidatesPublic", - "modifiedOn": 1629302053655, - "modifiedBy": "core:account:System", - "attributes": { - "firstName": "Marina", - "lastName": "M.", - "email": "marina@hc.engineering", - "phone": "+1 646 777 3333", - "city": "Los Angeles" - } - } -] \ No newline at end of file diff --git a/server/elastic/src/adapter.ts b/server/elastic/src/adapter.ts index 2a60273c25..d6a83e0c67 100644 --- a/server/elastic/src/adapter.ts +++ b/server/elastic/src/adapter.ts @@ -34,9 +34,8 @@ class ElasticAdapter implements FullTextAdapter { body: { } }) - const hits = result.body.hits.hits as [] - console.log(hits) - return [] + const hits = result.body.hits.hits as any[] + return hits.map(hit => hit._source) } async index (doc: IndexedDoc): Promise { @@ -45,7 +44,6 @@ class ElasticAdapter implements FullTextAdapter { type: '_doc', body: doc }) - console.log('indexing this thing: ', doc) } }