You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/filtering/FilterPathBasedFilter.java
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,41 @@ public TokenFilter includeProperty(String name) {
96
96
returnfilter;
97
97
}
98
98
99
+
/**
100
+
* This is overridden in order to keep empty arrays in nested exclusions - see #109668.
101
+
* <p>
102
+
* If we are excluding contents, we only want to exclude based on property name - but empty arrays in themselves do not have a property
103
+
* name. If the empty array were to be excluded, it should be done by excluding the parent.
104
+
* <p>
105
+
* Note though that the expected behavior seems to be ambiguous if contentsFiltered is true - that is, that the filter has pruned all
106
+
* the contents of a given array, such that we are left with the empty array. The behavior below drops that array, for at the time of
107
+
* writing, not doing so would cause assertions in JsonXContentFilteringTests to fail, which expect this behavior. Yet it is not obvious
108
+
* if dropping the empty array in this case is correct. For example, one could expect this sort of behavior:
0 commit comments