@@ -270,7 +270,12 @@ func (adh *AdminHandler) AddSearchAttributes(
270
270
}
271
271
}
272
272
273
- if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName {
273
+ // TODO (rodrigozhou): Remove condition `indexName == ""`.
274
+ // If indexName == "", then calling addSearchAttributesElasticsearch will
275
+ // register the search attributes in the cluster metadata if ES is up or if
276
+ // `skip-schema-update` is set. This is for backward compatibility using
277
+ // standard visibility.
278
+ if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName || indexName == "" {
274
279
err = adh .addSearchAttributesElasticsearch (ctx , request , indexName )
275
280
} else {
276
281
err = adh .addSearchAttributesSQL (ctx , request , currentSearchAttributes )
@@ -404,7 +409,12 @@ func (adh *AdminHandler) RemoveSearchAttributes(
404
409
}
405
410
406
411
var err error
407
- if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName {
412
+ // TODO (rodrigozhou): Remove condition `indexName == ""`.
413
+ // If indexName == "", then calling addSearchAttributesElasticsearch will
414
+ // register the search attributes in the cluster metadata if ES is up or if
415
+ // `skip-schema-update` is set. This is for backward compatibility using
416
+ // standard visibility.
417
+ if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName || indexName == "" {
408
418
err = adh .removeSearchAttributesElasticsearch (ctx , request , indexName )
409
419
} else {
410
420
err = adh .removeSearchAttributesSQL (ctx , request )
@@ -505,7 +515,12 @@ func (adh *AdminHandler) GetSearchAttributes(
505
515
return nil , serviceerror .NewUnavailable (fmt .Sprintf (errUnableToGetSearchAttributesMessage , err ))
506
516
}
507
517
508
- if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName {
518
+ // TODO (rodrigozhou): Remove condition `indexName == ""`.
519
+ // If indexName == "", then calling addSearchAttributesElasticsearch will
520
+ // register the search attributes in the cluster metadata if ES is up or if
521
+ // `skip-schema-update` is set. This is for backward compatibility using
522
+ // standard visibility.
523
+ if adh .visibilityMgr .GetName () == elasticsearch .PersistenceName || indexName == "" {
509
524
return adh .getSearchAttributesElasticsearch (ctx , indexName , searchAttributes )
510
525
}
511
526
return adh .getSearchAttributesSQL (request , searchAttributes )
0 commit comments