幾天來,我一直在嘗試了解如何使用 Go 根據多個字段進行排序olivere/elastic。我正在嘗試將其翻譯成 Go{ "sort" : [ "name", { "age" : "desc" }, ],}我嘗試在搜索服務中使用NewFieldSort()and give some 。SortBy()它適用于 oneSortBy()但不適用于 two SortBy()。它返回Error 400 (Bad Request): all shards failed [type=search_phase_execution_exception]這是我的代碼 sortQuery1 := elastic.NewFieldSort("name") sortQuery2 := elastic.NewFieldSort("age").Desc() searchService := esclient.Search(). Index("students"). SortBy(sortQuery1). SortBy(sortQuery2) searchResult, err := searchService.Do(ctx)你們對嘗試什么有什么建議嗎?提前致謝!
如何使用 Go Olivere/elastic 基于多個字段進行排序
慕碼人2483693
2022-06-21 09:55:06