attachment -> data

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-13 22:25:55 +02:00
parent 9479ce0f5c
commit 5f9e68c500
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
5 changed files with 10 additions and 7 deletions

View File

@ -21,7 +21,10 @@ curl -XPUT "localhost:9200/_ingest/pipeline/attachment?pretty" -H 'Content-Type:
"processors" : [
{
"attachment" : {
"field" : "attachment"
"field" : "data"
},
"remove" : {
"field" : "data"
}
}
]

View File

@ -52,7 +52,7 @@ export interface IndexedContent extends IndexedDoc {
* @public
*/
export interface IndexedAttachment extends IndexedDoc {
attachment: string
data: string
}
/**

View File

@ -28,8 +28,8 @@ client.ingest.putPipeline({
id: 'anticrm-pipeline',
body: {
processors: [
{ attachment: { field: 'attachment' } },
{ remove: { field: 'attachment' } }
{ attachment: { field: 'data' } },
{ remove: { field: 'data' } }
]
}
})

View File

@ -34,7 +34,7 @@ class ElasticAdapter implements FullTextAdapter {
query: {
match: {
// content: query.$search,
'att.content': query.$search
'attachment.content': query.$search
}
}
}
@ -46,7 +46,7 @@ class ElasticAdapter implements FullTextAdapter {
async index (doc: IndexedDoc): Promise<void> {
console.log('eastic: index', doc)
if ((doc as IndexedAttachment).attachment === undefined) {
if ((doc as IndexedAttachment).data === undefined) {
const resp = await this.client.index({
index: this.db,
type: '_doc',

View File

@ -154,7 +154,7 @@ export function start (transactorEndpoint: string, elasticUrl: string, minio: Cl
space,
modifiedOn: Date.now(),
modifiedBy: 'core:account:System' as Ref<Account>,
attachment: file.data.toString('base64')
data: file.data.toString('base64')
}
await elastic.index(indexedDoc)