-
Notifications
You must be signed in to change notification settings - Fork 269
Closed
Labels
Description
Object Builders for maps use an InternalMap
which is a sub-class of a hash map:
elasticsearch-java/java-client/src/main/java/co/elastic/clients/util/ObjectBuilderBase.java
Line 91 in 75feae5
private static final class InternalMap<K, V> extends HashMap<K, V> { |
Hash maps are unordered, the order is defined by the internal hashing function and can be different for different runtime environments. Although the JSON standard does not define dictionaries to be ordered, it would be good to switch to a linked hash map with insertion order:
- for a user the order might have a meaning and it is easier for them if the order is preserved the way the user specified it, e.g. the output might be a ML job or transform configuration
- in some cases order can be important at runtime: [Transform] HLRC builder ignores group_by order elasticsearch#82350
Because this does not seems performance-critical, I suggest to switch to a linked hash map with insertion order