@@ -71,9 +71,11 @@ public void createMappingAction(String indexName, String ruleTopic, String alias
71
71
// since you can't update documents in non-write indices
72
72
String index = indexName ;
73
73
boolean shouldUpsertIndexTemplate = IndexUtils .isConcreteIndex (indexName , this .clusterService .state ()) == false ;
74
- if (IndexUtils .isDataStream (indexName , this .clusterService .state ())) {
74
+ if (IndexUtils .isDataStream (indexName , this .clusterService .state ()) || IndexUtils .isAlias (indexName , this .clusterService .state ())) {
75
+ log .debug ("{} is an alias or datastream. Fetching write index for create mapping action." , indexName );
75
76
String writeIndex = IndexUtils .getWriteIndex (indexName , this .clusterService .state ());
76
77
if (writeIndex != null ) {
78
+ log .debug ("Write index for {} is {}" , indexName , writeIndex );
77
79
index = writeIndex ;
78
80
}
79
81
}
@@ -85,6 +87,7 @@ public void onResponse(GetMappingsResponse getMappingsResponse) {
85
87
applyAliasMappings (getMappingsResponse .getMappings (), ruleTopic , aliasMappings , partial , new ActionListener <>() {
86
88
@ Override
87
89
public void onResponse (Collection <CreateMappingResult > createMappingResponse ) {
90
+ log .debug ("Completed create mappings for {}" , indexName );
88
91
// We will return ack==false if one of the requests returned that
89
92
// else return ack==true
90
93
Optional <AcknowledgedResponse > notAckd = createMappingResponse .stream ()
@@ -103,6 +106,7 @@ public void onResponse(Collection<CreateMappingResult> createMappingResponse) {
103
106
104
107
@ Override
105
108
public void onFailure (Exception e ) {
109
+ log .debug ("Failed to create mappings for {}" , indexName );
106
110
actionListener .onFailure (e );
107
111
}
108
112
});
0 commit comments