Skip to content

[Synonym] Return Empty RuleSet #131032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Samiul-TheSoccerFan
Copy link
Contributor

This PR fixes an existing issue where GET _synonyms does not include ruleset with empty/no rules.

Setup

PUT _synonyms/ruleset-without-rules
{
  "synonyms_set": []
}

PUT _synonyms/ruleset-with-rules
{
  "synonyms_set": [
      {
        "id": "search_terms",
        "synonyms": "search,find,lookup,query => search"
      },
      {
        "id": "technology_terms", 
        "synonyms": "laptop,notebook,computer,pc"
      },
      {
        "id": "clothing_terms",
        "synonyms": "shirt,top,tee => shirt"
      },
      {
        "id": "vehicle_terms",
        "synonyms": "car,auto,automobile,vehicle"
      },
      {
        "id": "happy_emotions",
        "synonyms": "happy,joyful,cheerful,glad,pleased"
      }
    ]
  }
}

GET _synonyms //  return both

@Samiul-TheSoccerFan Samiul-TheSoccerFan added >bug auto-backport Automatically create backport pull requests when merged :SearchOrg/Relevance Label for the Search (solution/org) Relevance team v9.1.0 v9.2.0 v8.19.1 v9.0.5 v8.18.5 labels Jul 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @Samiul-TheSoccerFan, I've created a changelog YAML for you.

@Samiul-TheSoccerFan Samiul-TheSoccerFan added the Team:Search - Relevance The Search organization Search Relevance team label Jul 10, 2025
@Samiul-TheSoccerFan Samiul-TheSoccerFan marked this pull request as ready for review July 10, 2025 16:44
@elasticsearchmachine elasticsearchmachine added the Team:SearchOrg Meta label for the Search Org (Enterprise Search) label Jul 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-eng (Team:SearchOrg)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-relevance (Team:Search - Relevance)

@carlosdelest
Copy link
Member

Nice work @Samiul-TheSoccerFan ! Thanks for fixing this bug 🐛 , changes LGTM.

You'll need to add the new test feature to other YAML test suites - check #129766 for an example of adding the test feature to other YAML tests. Apply this to all the YAML tests suites that error out

Copy link
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Samiul-TheSoccerFan !

I added some comments about fixing the CI failures.

@Samiul-TheSoccerFan
Copy link
Contributor Author

Thank you @carlosdelest for the review. One note related to the CI failures, I added the new FeatureSpecification (see commit) as per CI logs. Do we still need to add a FeatureFlag or this should be enough?

Copy link
Member

@kderusso kderusso left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work. I'm not sure if we have to add a feature flag @carlosdelest per your example?

@Samiul-TheSoccerFan
Copy link
Contributor Author

@elasticmachine update branch

@carlosdelest
Copy link
Member

You'll need to add the new test feature to other YAML test suites - check #129766

@Samiul-TheSoccerFan @kderusso I'm sorry, I threw you on the wrong path - there is no need to implement the code I mentioned, it is enough with what is implemented here. I saw the errors and automatically remembered that, should have double checked.

@Samiul-TheSoccerFan
Copy link
Contributor Author

Thank you @carlosdelest for the confirmation :)

@Samiul-TheSoccerFan Samiul-TheSoccerFan merged commit a12338a into elastic:main Jul 11, 2025
33 checks passed
Samiul-TheSoccerFan added a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.1
8.19
9.0
8.18

Samiul-TheSoccerFan added a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Samiul-TheSoccerFan added a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Samiul-TheSoccerFan added a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Jul 11, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 17, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 17, 2025
* Adding filter agg to include empty synonym sets

* Adding featurespecification for synonyms

* linting

* Update docs/changelog/131032.yaml

* update changelog

* Adding synonym feature into module-info

* sorted the expected response

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :SearchOrg/Relevance Label for the Search (solution/org) Relevance team Team:Search - Relevance The Search organization Search Relevance team Team:SearchOrg Meta label for the Search Org (Enterprise Search) v8.18.5 v8.19.1 v9.0.5 v9.1.0 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants