12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package services
- import (
- "eta/eta_mini_crm/services/elastic"
- "eta/eta_mini_crm/utils"
- "fmt"
- )
- func InitTask() {
- fmt.Println("start task")
- CreateIndex()
- fmt.Println("end task!")
- }
- func CreateIndex() {
- var mappingJson = `{
- "mappings": {
- "properties": {
- "ReportPdfId": {"type": "integer"},
- "PdfUrl": {"type": "text"},
- "PdfName": {"type": "text"},
- "Title": {"type": "text"},
- "Author": {"type": "text"},
- "Abstract": {"type": "text"},
- "ClassifyIdFirst": {"type": "integer"},
- "ClassifyNameFirst": {"type": "text"},
- "ClassifyIdSecond": {"type": "integer"},
- "ClassifyNameSecond": {"type": "text"},
- "Stage": {"type": "integer"},
- "PublishTime": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 256
- }
- }
- },
- "ModifyTime": {"type": "date"},
- "Pv": {"type": "integer"},
- "Uv": {"type": "integer"},
- "SysUserId": {"type": "integer"},
- "SysRealName": {"type": "text"},
- "State": {"type": "integer"}
- }
- }
- }`
- err := elastic.EsCreateIndex(utils.MINI_REPORT_INDEX_NAME, mappingJson)
- if err != nil {
- fmt.Println(err)
- }
- }
|