diff --git a/pkg/quickwit/response_parser.go b/pkg/quickwit/response_parser.go index 57daa65..d3e0892 100644 --- a/pkg/quickwit/response_parser.go +++ b/pkg/quickwit/response_parser.go @@ -1054,6 +1054,7 @@ func flatten(target map[string]interface{}) map[string]interface{} { if shouldStepInside { currentDepth++ step(v, newKey) + currentDepth-- } else { output[newKey] = value } diff --git a/pkg/quickwit/response_parser_test.go b/pkg/quickwit/response_parser_test.go index bbdf1ea..2fe1c79 100644 --- a/pkg/quickwit/response_parser_test.go +++ b/pkg/quickwit/response_parser_test.go @@ -3166,11 +3166,17 @@ func TestFlatten(t *testing.T) { }, }, }, + "other": map[string]interface{}{ + "nested1": map[string]interface{}{ + "nested2": "def", + }, + }, } flattened := flatten(obj) - require.Len(t, flattened, 1) + require.Len(t, flattened, 2) require.Equal(t, map[string]interface{}{"nested11": map[string]interface{}{"nested12": "abc"}}, flattened["nested0.nested1.nested2.nested3.nested4.nested5.nested6.nested7.nested8.nested9.nested10"]) + require.Equal(t, "def", flattened["other.nested1.nested2"]) }) }