@@ -57,12 +57,6 @@ public class FieldCapabilities implements Writeable, ToXContentObject {
57
57
private static final ParseField NON_AGGREGATABLE_INDICES_FIELD = new ParseField ("non_aggregatable_indices" );
58
58
private static final ParseField META_FIELD = new ParseField ("meta" );
59
59
60
- private static Map <String , Set <String >> mapToMapOfSets (Map <String , String > map ) {
61
- final Function <Map .Entry <String , String >, String > entryValueFunction = Map .Entry ::getValue ;
62
- return map .entrySet ().stream ().collect (
63
- Collectors .toUnmodifiableMap (Map .Entry ::getKey , entryValueFunction .andThen (Set ::of )));
64
- }
65
-
66
60
private final String name ;
67
61
private final String type ;
68
62
private final boolean isSearchable ;
@@ -74,19 +68,6 @@ private static Map<String, Set<String>> mapToMapOfSets(Map<String, String> map)
74
68
75
69
private final Map <String , Set <String >> meta ;
76
70
77
- /**
78
- * Constructor for a single index.
79
- * @param name The name of the field.
80
- * @param type The type associated with the field.
81
- * @param isSearchable Whether this field is indexed for search.
82
- * @param isAggregatable Whether this field can be aggregated on.
83
- * @param meta Metadata about the field.
84
- */
85
- public FieldCapabilities (String name , String type , boolean isSearchable , boolean isAggregatable ,
86
- Map <String , String > meta ) {
87
- this (name , type , isSearchable , isAggregatable , null , null , null , mapToMapOfSets (Objects .requireNonNull (meta )));
88
- }
89
-
90
71
/**
91
72
* Constructor for a set of indices.
92
73
* @param name The name of the field
@@ -102,11 +83,11 @@ public FieldCapabilities(String name, String type, boolean isSearchable, boolean
102
83
* @param meta Merged metadata across indices.
103
84
*/
104
85
public FieldCapabilities (String name , String type ,
105
- boolean isSearchable , boolean isAggregatable ,
106
- String [] indices ,
107
- String [] nonSearchableIndices ,
108
- String [] nonAggregatableIndices ,
109
- Map <String , Set <String >> meta ) {
86
+ boolean isSearchable , boolean isAggregatable ,
87
+ String [] indices ,
88
+ String [] nonSearchableIndices ,
89
+ String [] nonAggregatableIndices ,
90
+ Map <String , Set <String >> meta ) {
110
91
this .name = name ;
111
92
this .type = type ;
112
93
this .isSearchable = isSearchable ;
@@ -117,7 +98,7 @@ public FieldCapabilities(String name, String type,
117
98
this .meta = Objects .requireNonNull (meta );
118
99
}
119
100
120
- public FieldCapabilities (StreamInput in ) throws IOException {
101
+ FieldCapabilities (StreamInput in ) throws IOException {
121
102
this .name = in .readString ();
122
103
this .type = in .readString ();
123
104
this .isSearchable = in .readBoolean ();
@@ -309,35 +290,20 @@ static class Builder {
309
290
this .meta = new HashMap <>();
310
291
}
311
292
312
- private void add (String index , boolean search , boolean agg ) {
293
+ /**
294
+ * Collect the field capabilities for an index.
295
+ */
296
+ void add (String index , boolean search , boolean agg , Map <String , String > meta ) {
313
297
IndexCaps indexCaps = new IndexCaps (index , search , agg );
314
298
indiceList .add (indexCaps );
315
299
this .isSearchable &= search ;
316
300
this .isAggregatable &= agg ;
317
- }
318
-
319
- /**
320
- * Collect capabilities of an index.
321
- */
322
- void add (String index , boolean search , boolean agg , Map <String , String > meta ) {
323
- add (index , search , agg );
324
301
for (Map .Entry <String , String > entry : meta .entrySet ()) {
325
302
this .meta .computeIfAbsent (entry .getKey (), key -> new HashSet <>())
326
303
.add (entry .getValue ());
327
304
}
328
305
}
329
306
330
- /**
331
- * Merge another capabilities instance.
332
- */
333
- void merge (String index , boolean search , boolean agg , Map <String , Set <String >> meta ) {
334
- add (index , search , agg );
335
- for (Map .Entry <String , Set <String >> entry : meta .entrySet ()) {
336
- this .meta .computeIfAbsent (entry .getKey (), key -> new HashSet <>())
337
- .addAll (entry .getValue ());
338
- }
339
- }
340
-
341
307
List <String > getIndices () {
342
308
return indiceList .stream ().map (c -> c .name ).collect (Collectors .toList ());
343
309
}
0 commit comments