milvus-sdk-go icon indicating copy to clipboard operation
milvus-sdk-go copied to clipboard

Not able to insert in milvus collection

Open AnandKumarTokopedia opened this issue 3 years ago • 5 comments

I am using a simple program to insert data into milvus.

	// row-base covert to column-base
	ids := make([]int64, 0, 1)
	ids = append(ids, 23)

	vectors := make([][]float32, 0, 1)
	vectors = append(vectors, ip.GetVector())

	var entities []milvus.Entity

	entities = []milvus.Entity{{
		FloatData: []float32{float32(10.3232)},
	}}
	//index(context.Background(), collectionName)
	result, status, err := Client.Insert(context.Background(), &milvus.InsertParam{
		CollectionName: collectionName,
		RecordArray:    entities,
		IDArray:        ids,
		PartitionTag:   "hi",
	})

if err != nil {
		log.Println("failed to create collection:", err.Error())
	}
	if !status.Ok() {
		fmt.Errorf("error inserting vectors %v: %v", collectionName, status.GetStatus())
	}

	status, err = Client.Flush(context.Background(), []string{collectionName})
	if err != nil {
		log.Fatal("failed to flush collection:", err.Error())
	}
	if !status.Ok() {
		fmt.Errorf("error flushing vectors %v: %v", collectionName, status.GetStatus())
	}
	log.Println("flush completed")

	for _, v := range result {
		fmt.Printf("result after insertion %+v\n", v)
	}

Their is no error also after inserting and flushing. Still the entity is not inserted into the collection. Can anyone help

AnandKumarTokopedia avatar Oct 08 '21 10:10 AnandKumarTokopedia

Hi @AnandKumarTokopedia. Thanks for the reply. From the code snippet, it seems that you are using 1.X SDK. Are you using 1.X milvus instance?

congqixia avatar Oct 08 '21 11:10 congqixia

@congqixia Can you please help let me know how to check that

AnandKumarTokopedia avatar Oct 08 '21 11:10 AnandKumarTokopedia

@congqixia Can you please help let me know how to check that

@AnandKumarTokopedia How did you install Milvus? Using Docker image or just built it from source code?

congqixia avatar Oct 08 '21 11:10 congqixia

It was using docker @congqixia

AnandKumarTokopedia avatar Oct 08 '21 11:10 AnandKumarTokopedia

It was using docker @congqixia

@AnandKumarTokopedia then could you please provide the docker logs from milvus container?

congqixia avatar Oct 08 '21 11:10 congqixia