File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
server/src/main/java/org/elasticsearch/cluster/metadata Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -154,15 +154,13 @@ void addIndex(IndexMetaData indexMetaData) {
154154 }
155155
156156 public void computeAndValidateWriteIndex () {
157- final List <IndexMetaData > writeIndices ;
158- if (referenceIndexMetaDatas .size () > 1 ) {
159- writeIndices = referenceIndexMetaDatas .stream ()
160- .filter (idxMeta -> Boolean .TRUE .equals (idxMeta .getAliases ().get (aliasName ).writeIndex ()))
161- .collect (Collectors .toList ());
162- } else if (Boolean .FALSE .equals (referenceIndexMetaDatas .get (0 ).getAliases ().get (aliasName ).writeIndex ()) == false ) {
163- writeIndices = Collections .singletonList (referenceIndexMetaDatas .get (0 ));
164- } else {
165- writeIndices = Collections .emptyList ();
157+ List <IndexMetaData > writeIndices = referenceIndexMetaDatas .stream ()
158+ .filter (idxMeta -> Boolean .TRUE .equals (idxMeta .getAliases ().get (aliasName ).writeIndex ()))
159+ .collect (Collectors .toList ());
160+
161+ if (writeIndices .isEmpty () && referenceIndexMetaDatas .size () == 1
162+ && referenceIndexMetaDatas .get (0 ).getAliases ().get (aliasName ).writeIndex () == null ) {
163+ writeIndices .add (referenceIndexMetaDatas .get (0 ));
166164 }
167165
168166 if (writeIndices .size () == 1 ) {
You can’t perform that action at this time.
0 commit comments