diff --git a/x-pack/elastic-agent/pkg/agent/transpiler/ast.go b/x-pack/elastic-agent/pkg/agent/transpiler/ast.go index 100d8a462a0..31bb2faaa7c 100644 --- a/x-pack/elastic-agent/pkg/agent/transpiler/ast.go +++ b/x-pack/elastic-agent/pkg/agent/transpiler/ast.go @@ -716,8 +716,10 @@ func load(val reflect.Value) (Node, error) { return loadSliceOrArray(val) case reflect.String: return &StrVal{value: val.Interface().(string)}, nil - case reflect.Int, reflect.Int64: + case reflect.Int: return &IntVal{value: val.Interface().(int)}, nil + case reflect.Int64: + return &IntVal{value: int(val.Interface().(int64))}, nil case reflect.Uint: return &UIntVal{value: uint64(val.Interface().(uint))}, nil case reflect.Uint64: diff --git a/x-pack/elastic-agent/pkg/agent/transpiler/ast_test.go b/x-pack/elastic-agent/pkg/agent/transpiler/ast_test.go index e1b22c390ed..1e52d6c6f47 100644 --- a/x-pack/elastic-agent/pkg/agent/transpiler/ast_test.go +++ b/x-pack/elastic-agent/pkg/agent/transpiler/ast_test.go @@ -105,6 +105,7 @@ func TestAST(t *testing.T) { "support integers": { hashmap: map[string]interface{}{ "timeout": 12, + "zero": int64(0), "range": []int{20, 30, 40}, }, ast: &AST{ @@ -121,6 +122,7 @@ func TestAST(t *testing.T) { ), }, &Key{name: "timeout", value: &IntVal{value: 12}}, + &Key{name: "zero", value: &IntVal{value: 0}}, }, }, },