Skip to content

Conversation

@DEVMANISHOFFL
Copy link

What's being changed:

This PR changes the behavior of AddSearchAttributes to return a clear error when trying to add a search attribute that already exists (Fixes #8631).

The Issue:
In the past, the server would log a warning and return nil (success) when a duplicate was found. This led clients, such as the CLI, to report "Search attributes have been added" even though no changes were made.

The Fix:
I updated addSearchAttributesElasticsearch and addSearchAttributesSQL to return serviceerror.NewAlreadyExists right away when a duplicate alias or field is detected.

Test Coverage:
I modified Test_AddSearchAttributesElasticsearch and Test_AddSearchAttributesSQL in operator_handler_test.go to expect this new error instead of the earlier success-with-warning behavior.

Review checklist

  • Documentation has been updated, if necessary. Link to changed documentation:
  • Chaos pipeline run or not necessary. Link to pipeline:
  • All new code is covered by tests where it is reasonable.
  • Performance tests have been run or not necessary.

@DEVMANISHOFFL DEVMANISHOFFL requested review from a team as code owners January 5, 2026 18:06
@bergundy
Copy link
Member

bergundy commented Jan 8, 2026

Thanks for the contribution @DEVMANISHOFFL, see my comments in the original issue.

Copy link
Contributor

@rodrigozhou rodrigozhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DEVMANISHOFFL Also commented in the issue. This PR not only breaks backwards compatibility, but also blocks dual visibility from working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trying to create search attribute that already exists should return error

3 participants