Browse Source

fix: 数据源es

hsun 2 months ago
parent
commit
e99f3377fb

+ 1 - 1
controllers/data_source/data_source.go

@@ -121,7 +121,7 @@ func (c *DataSourceController) SearchByEs() {
 	for _, v := range list {
 		// (短期方案)由于start_date、end_date和latest_value字段不全的历史遗留问题,这里查出来并补充进ES里面去
 		var updateEs bool
-		if v.StartDate == "" || v.EndDate == "" || v.LatestValue == 0 {
+		if v.StartDate == "" || v.EndDate == "" || v.LatestValue == "" || v.LatestValue == "0" {
 			minMax, e := dataSourceModel.GetBaseIndexDataMinMax(v.Source, v.SubSource, v.IndexCode)
 			if e != nil && e.Error() != utils.ErrNoRow() {
 				br.Msg = "获取失败"

+ 47 - 47
models/data_source/data_source.go

@@ -11,21 +11,21 @@ import (
 
 // SearchDataSource 数据源ES搜索
 type SearchDataSource struct {
-	PrimaryId   int     `description:"主键ID"`
-	IndexCode   string  `description:"指标编码"`
-	IndexName   string  `description:"指标名称"`
-	ClassifyId  int     `description:"分类ID"`
-	Unit        string  `description:"单位"`
-	Frequency   string  `description:"频度"`
-	StartDate   string  `description:"开始日期"`
-	EndDate     string  `description:"结束日期"`
-	LatestValue float64 `description:"最新值"`
-	Source      int     `description:"来源"`
-	SourceName  string  `description:"数据源名称"`
-	SubSource   int     `description:"子来源"`
-	IsDeleted   int     `description:"是否已删除:0-正常;1-已删除"`
-	CreateTime  string  `description:"创建时间"`
-	ModifyTime  string  `description:"修改时间"`
+	PrimaryId   int    `description:"主键ID"`
+	IndexCode   string `description:"指标编码"`
+	IndexName   string `description:"指标名称"`
+	ClassifyId  int    `description:"分类ID"`
+	Unit        string `description:"单位"`
+	Frequency   string `description:"频度"`
+	StartDate   string `description:"开始日期"`
+	EndDate     string `description:"结束日期"`
+	LatestValue string `description:"最新值(部分数据源如中国煤炭网存在97%这种数据...)"`
+	Source      int    `description:"来源"`
+	SourceName  string `description:"数据源名称"`
+	SubSource   int    `description:"子来源"`
+	IsDeleted   int    `description:"是否已删除:0-正常;1-已删除"`
+	CreateTime  string `description:"创建时间"`
+	ModifyTime  string `description:"修改时间"`
 }
 
 // SearchDataSourceItem 数据源ES搜索
@@ -197,7 +197,7 @@ func (m *BaseFromRzdIndex) Format2SearchDataSource(origin *BaseFromRzdIndex) (it
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -273,7 +273,7 @@ func (m *BaseFromHisugarIndex) Format2SearchDataSource(origin *BaseFromHisugarIn
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -347,7 +347,7 @@ func (m *BaseFromLyIndex) Format2SearchDataSource(origin *BaseFromLyIndex) (item
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -424,7 +424,7 @@ func (m *BaseFromSciHqIndex) Format2SearchDataSource(origin *BaseFromSciHqIndex)
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -497,7 +497,7 @@ func (m *BaseFromOilchemIndex) Format2SearchDataSource(origin *BaseFromOilchemIn
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -580,7 +580,7 @@ func (m *BaseFromThsHfIndex) Format2SearchDataSource(origin *BaseFromThsHfIndex)
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDateTime, origin.StartDate) // 高频这里是到时分秒
 	item.EndDate = utils.TimeTransferString(utils.FormatDateTime, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -653,7 +653,7 @@ func (m *BaseFromCcfIndex) Format2SearchDataSource(origin *BaseFromCcfIndex) (it
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -726,7 +726,7 @@ func (m *BaseFromUsdaFasIndex) Format2SearchDataSource(origin *BaseFromUsdaFasIn
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -799,7 +799,7 @@ func (m *BaseFromMysteelChemicalIndex) Format2SearchDataSource(origin *BaseFromM
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -872,7 +872,7 @@ func (m *BaseFromSmmIndex) Format2SearchDataSource(origin *BaseFromSmmIndex) (it
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -945,7 +945,7 @@ func (m *BaseFromBaiinfoIndex) Format2SearchDataSource(origin *BaseFromBaiinfoIn
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1018,7 +1018,7 @@ func (m *BaseFromSciIndex) Format2SearchDataSource(origin *BaseFromSciIndex) (it
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1052,7 +1052,7 @@ type BaseFromCoalmineMapping struct {
 	Frequency                 string    `description:"频度"`
 	StartDate                 time.Time `description:"开始日期"`
 	EndDate                   time.Time `description:"结束日期"`
-	LatestValue               float64   `description:"最新值"`
+	LatestValue               string    `description:"最新值"`
 	CreateTime                time.Time `description:"创建时间"`
 	ModifyTime                time.Time `description:"更新时间"`
 }
@@ -1164,7 +1164,7 @@ func (m *BaseFromEiaSteoIndex) Format2SearchDataSource(origin *BaseFromEiaSteoIn
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1237,7 +1237,7 @@ func (m *BaseFromIcpiIndex) Format2SearchDataSource(origin *BaseFromIcpiIndex) (
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1310,7 +1310,7 @@ func (m *BaseFromYongyiIndex) Format2SearchDataSource(origin *BaseFromYongyiInde
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1383,7 +1383,7 @@ func (m *BaseFromFenweiIndex) Format2SearchDataSource(origin *BaseFromFenweiInde
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1456,7 +1456,7 @@ func (m *BaseFromSci99Index) Format2SearchDataSource(origin *BaseFromSci99Index)
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1528,7 +1528,7 @@ func (m *BaseFromGlIndex) Format2SearchDataSource(origin *BaseFromGlIndex) (item
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1601,7 +1601,7 @@ func (m *BaseFromManualEdb) Format2SearchDataSource(origin *BaseFromManualEdb) (
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1674,7 +1674,7 @@ func (m *BaseFromBusinessIndex) Format2SearchDataSource(origin *BaseFromBusiness
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1747,7 +1747,7 @@ func (m *BaseFromBloombergIndex) Format2SearchDataSource(origin *BaseFromBloombe
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1820,7 +1820,7 @@ func (m *BaseFromMtjhMapping) Format2SearchDataSource(origin *BaseFromMtjhMappin
 	item.Frequency = origin.Frequency
 	item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
 	item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
-	item.LatestValue = origin.LatestValue
+	item.LatestValue = fmt.Sprint(origin.LatestValue)
 	item.Source = source
 	item.SubSource = subSource
 	item.SourceName = sourceName
@@ -1846,9 +1846,9 @@ func (m *BaseFromMtjhMapping) GetItemsByCondition(condition string, pars []inter
 
 // BaseIndexDataMinMax 数据源极值信息
 type BaseIndexDataMinMax struct {
-	MinDate     string  `description:"最小日期"`
-	MaxDate     string  `description:"最大日期"`
-	LatestValue float64 `description:"最新值"`
+	MinDate     string `description:"最小日期"`
+	MaxDate     string `description:"最大日期"`
+	LatestValue string `description:"最新值"`
 	//MinValue    float64 `description:"最小值"`
 	//MaxValue    float64 `description:"最大值"`
 }
@@ -1945,7 +1945,7 @@ func getCoalmineDataTableName(indexCode string) string {
 func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *BaseIndexDataMinMax, err error) {
 	o := orm.NewOrmUsingDB("data")
 	var sql string
-	var latestVal float64
+	var latestVal string
 
 	// 煤炭江湖
 	if source == utils.DATA_SOURCE_MTJH {
@@ -2077,7 +2077,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
 	itemsOnce := make([]*BaseFromCoalmineIndexBase, 0)
 	if len(jsmCodes) > 0 {
 		sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_jsm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(jsmCodes)))
-		_, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
+		_, err = o.Raw(sql, jsmCodes).QueryRows(&itemsOnce)
 		if err != nil {
 			return
 		}
@@ -2085,7 +2085,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
 	}
 	if len(companyCodes) > 0 {
 		sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_company_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(companyCodes)))
-		_, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
+		_, err = o.Raw(sql, companyCodes).QueryRows(&itemsOnce)
 		if err != nil {
 			return
 		}
@@ -2093,7 +2093,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
 	}
 	if len(firmCodes) > 0 {
 		sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_firm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(firmCodes)))
-		_, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
+		_, err = o.Raw(sql, firmCodes).QueryRows(&itemsOnce)
 		if err != nil {
 			return
 		}
@@ -2101,7 +2101,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
 	}
 	if len(coastalCodes) > 0 {
 		sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_coastal_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(coastalCodes)))
-		_, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
+		_, err = o.Raw(sql, coastalCodes).QueryRows(&itemsOnce)
 		if err != nil {
 			return
 		}
@@ -2109,7 +2109,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
 	}
 	if len(inlandCodes) > 0 {
 		sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_inland_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(inlandCodes)))
-		_, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
+		_, err = o.Raw(sql, inlandCodes).QueryRows(&itemsOnce)
 		if err != nil {
 			return
 		}

+ 5 - 2
services/binlog/handler.go

@@ -315,11 +315,14 @@ func DataSourceMapRowToStruct(columns []schema.TableColumn, row []interface{}, i
 			if !value.IsValid() {
 				continue
 			}
+			if value.Kind() == reflect.String {
+				item.LatestValue = value.String()
+			}
 			if value.Kind() == reflect.Int || value.Kind() == reflect.Int32 || value.Kind() == reflect.Int64 {
-				item.LatestValue = float64(value.Int())
+				item.LatestValue = fmt.Sprint(value.Int())
 			}
 			if value.Kind() == reflect.Float64 {
-				item.LatestValue = value.Float()
+				item.LatestValue = fmt.Sprint(value.Float())
 			}
 		case indexCols.CreateTime:
 			if value.IsValid() {

+ 1 - 1
services/temp_fix.go

@@ -54,7 +54,7 @@ func FixNewEs() {
 		return
 	}
 	fmt.Println("开始创建数据源索引:", utils.EsDataSourceIndexName)
-	indexMappingB := `{"mappings":{"properties":{"ClassifyId":{"type":"long"},"CreateTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"EndDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Frequency":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IndexCode":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IndexName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IsDeleted":{"type":"long"},"LatestValue":{"type":"double"},"ModifyTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"PrimaryId":{"type":"long"},"Source":{"type":"long"},"SourceName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"SubSource":{"type":"long"},"StartDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Unit":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}}`
+	indexMappingB := `{"mappings":{"properties":{"ClassifyId":{"type":"long"},"CreateTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"EndDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Frequency":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IndexCode":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IndexName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"IsDeleted":{"type":"long"},"LatestValue":{"type":"text"},"ModifyTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"PrimaryId":{"type":"long"},"Source":{"type":"long"},"SourceName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"SubSource":{"type":"long"},"StartDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Unit":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}}`
 	//indexMappingB := `{"settings":{"analysis":{"analyzer":{"ik_analyzer":{"type":"custom","tokenizer":"ik_max_word"},"ngram_analyzer":{"type":"custom","tokenizer":"standard","filter":["lowercase","ngram_filter"]}},"filter":{"ngram_filter":{"type":"ngram","min_gram":1,"max_gram":2,"token_chars":["letter","digit"]}}}},"mappings":{"properties":{"ClassifyId":{"type":"long"},"CreateTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"EndDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Frequency":{"type":"text","analyzer":"ik_smart"},"IndexCode":{"type":"text","fields":{"ngram":{"type":"text","analyzer":"ngram_analyzer","search_analyzer":"standard"},"keyword":{"type":"keyword","ignore_above":256}}},"IndexName":{"type":"text","fields":{"ik":{"type":"text","analyzer":"ik_analyzer","search_analyzer":"ik_analyzer"},"ngram":{"type":"text","analyzer":"ngram_analyzer","search_analyzer":"standard"},"keyword":{"type":"keyword","ignore_above":256}}},"IsDeleted":{"type":"long"},"LatestValue":{"type":"double"},"ModifyTime":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"PrimaryId":{"type":"long"},"Source":{"type":"long"},"SourceName":{"type":"text","analyzer":"ik_smart"},"SubSource":{"type":"long"},"StartDate":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"Unit":{"type":"text","analyzer":"ik_smart"}}}}`
 	if e := elastic.CreateEsIndex(utils.EsDataSourceIndexName, indexMappingB); e != nil {
 		err = fmt.Errorf("创建数据源索引失败, %v", e)