Browse Source

fix:清除无用文件

zqbao 8 months ago
parent
commit
eb54947cdf
1 changed files with 0 additions and 72 deletions
  1. 0 72
      test/es_test.go

+ 0 - 72
test/es_test.go

@@ -1,72 +0,0 @@
-package test
-
-import (
-	"context"
-	"eta/eta_mini_crm/utils"
-	"fmt"
-	"testing"
-)
-
-// indexName:索引名称
-// mappingJson:表结构
-func EsCreateIndex(indexName, mappingJson string) (err error) {
-	client := utils.EsClient
-
-	//定义表结构
-	exists, err := client.IndexExists(indexName).Do(context.Background()) //<5>
-	if err != nil {
-		return
-	}
-	if !exists {
-		resp, err := client.CreateIndex(indexName).BodyJson(mappingJson).Do(context.Background())
-		//BodyJson(bodyJson).Do(context.Background())
-		if err != nil {
-			fmt.Println("CreateIndex Err:" + err.Error())
-			return err
-		}
-		fmt.Println(resp.Index, resp.ShardsAcknowledged, resp.Acknowledged)
-	} else {
-		fmt.Println(indexName + " 已存在")
-	}
-	return
-}
-
-func TestCreateIndex(t *testing.T) {
-	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 := EsCreateIndex(utils.MINI_REPORT_INDEX_NAME, mappingJson)
-	if err != nil {
-		fmt.Println(err)
-	}
-
-}