|
@@ -1,4 +1,4 @@
|
|
|
-import { Body, Controller, Inject, Post } from '@midwayjs/core';
|
|
|
+import { Body, Controller, Inject, Param, Post } from '@midwayjs/core';
|
|
|
import { ESService } from '../service/elasticsearch/es.service';
|
|
|
|
|
|
@Controller('/init')
|
|
@@ -17,6 +17,12 @@ export class InitController {
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
+ @Post('/indices/:index')
|
|
|
+ async initIndex(@Param('index') index:string) {
|
|
|
+ const data = await this.esService.initOneIndex(index)
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
@Post('/data')
|
|
|
async data(@Body('index') index: string, @Body('data') data: Array<any>) {
|
|
|
console.log(`in init data: ${index} - ${data.length}`)
|