Skip to content

Commit

Permalink
Mapping: Using _default_ mapping type with _source excludes (or array…
Browse files Browse the repository at this point in the history
… based config) can cause the array to grow indefinitely

closes elastic#2317
  • Loading branch information
kimchy committed Oct 12, 2012
1 parent 6e593ba commit aa50458
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -219,8 +218,13 @@ public static void mergeDefaults(Map<String, Object> content, Map<String, Object
}
} else {
// if both are lists, simply combine them, first the defaults, then the content
mergedList.addAll((Collection) defaultEntry.getValue());
mergedList.addAll((Collection) content.get(defaultEntry.getKey()));
// just make sure not to add the same value twice
mergedList.addAll(defaultList);
for (Object o : contentList) {
if (!mergedList.contains(o)) {
mergedList.add(o);
}
}
}
content.put(defaultEntry.getKey(), mergedList);
}
Expand Down

0 comments on commit aa50458

Please sign in to comment.