소스 검색

update

master
DengBiao 1 년 전
부모
커밋
a16543b7da
2개의 변경된 파일17개의 추가작업 그리고 14개의 파일을 삭제
  1. +5
    -6
      es/utils_test.go
  2. +12
    -8
      md/es.go

+ 5
- 6
es/utils_test.go 파일 보기

@@ -4,7 +4,6 @@ import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/md"
"fmt"
"testing"
"time"
)

func TestCreateIndex(t *testing.T) {
@@ -31,7 +30,7 @@ func TestDeleteIndex(t *testing.T) {

func TestCreateDoc(t *testing.T) {
// 创建文档
now := time.Now().Unix()
//now := time.Now().Unix()
Init("http://120.55.48.175:9200", "elastic", "fnuo123")
createDocRet, err := CreateDoc(md.ZhiosOrdersEsIndex, "2_18_alex333", md.ZhiosOrdersEs{
MasterId: 1,
@@ -44,7 +43,7 @@ func TestCreateDoc(t *testing.T) {
CostPrice: 8,
State: 9,
StateZh: "完成",
PayTime: int(now),
PayTime: "2020-10-06 17:20:21",
PayChannel: 12,
PayChannelZh: "13",
ReceiverPhone: "14",
@@ -56,9 +55,9 @@ func TestCreateDoc(t *testing.T) {
OrderType: 20,
EstimateCommission: 21,
LogisticCompany: "22",
OrdCreateTime: int(now),
CreatedAt: int(now),
UpdatedAt: int(now),
OrdCreateTime: "2020-10-06 17:20:21",
CreatedAt: "2020-10-06 17:20:21",
UpdatedAt: "2020-10-06 17:20:21",
})
if err != nil {
panic(err)


+ 12
- 8
md/es.go 파일 보기

@@ -49,7 +49,8 @@ const ZhiosOrdersEsMapping = `
"type": "keyword"
},
"pay_time":{
"type": "date"
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"pay_channel":{
"type": "integer"
@@ -86,13 +87,16 @@ const ZhiosOrdersEsMapping = `
"type": "keyword"
},
"ord_create_time":{
"type": "date"
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"created_at":{
"type": "date"
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"updated_at":{
"type": "date"
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
@@ -109,7 +113,7 @@ type ZhiosOrdersEs struct {
CostPrice float64 `json:"cost_price"`
State int32 `json:"state"`
StateZh string `json:"state_zh"`
PayTime int `json:"pay_time"`
PayTime string `json:"pay_time"`
PayChannel int32 `json:"pay_channel"`
PayChannelZh string `json:"pay_channel_zh"`
ReceiverPhone string `json:"receiver_phone"`
@@ -121,7 +125,7 @@ type ZhiosOrdersEs struct {
OrderType int32 `json:"order_type"`
EstimateCommission float64 `json:"estimate_commission"`
LogisticCompany string `json:"logistic_company"`
OrdCreateTime int `json:"ord_create_time"`
CreatedAt int `json:"created_at"`
UpdatedAt int `json:"updated_at"`
OrdCreateTime string `json:"ord_create_time"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}

불러오는 중...
취소
저장