I am using the new ESQL library in Go. While fetching data from it, the fields of inner structs are not getting populated.
type ProcessedLog struct {
EventName string `json:"event_name"`
SessionId string `json:"session_id"`
Device Device `json:"device"`
User User `json:"user"`
}
func (e ElasticStore) Logs(sessionId string, date string) ([]ProcessedLog, error) {
query := "FROM " + e.rawLogIndex + "_" + date +
` | WHERE session_id == "` + sessionId + `"`
return EsqlQueryMapper[ProcessedLog](query)
}
func EsqlQueryMapper[T any](queryStr string) ([]T, error) {
qry := instance.client.Esql.Query().Query(queryStr)
return query.Helper[T](context.Background(), qry)
}
Here, the EventName and SessionId gets populated but the fields in the Device and User struct do not.