- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25.6k
Non existing synonyms sets do not fail shard recovery #125659
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
Changes from 2 commits
a77c9a4
              88abdff
              41e66ce
              ad8474f
              5a0149e
              1623a0e
              636bea9
              dd3db4d
              ecb2f26
              444ca17
              7967259
              bb6f970
              b88fdc4
              d78eff2
              5f813b1
              6ace60b
              19955f2
              cec345f
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -48,6 +48,8 @@ | |
| import org.apache.lucene.analysis.th.ThaiAnalyzer; | ||
| import org.apache.lucene.analysis.tr.TurkishAnalyzer; | ||
| import org.apache.lucene.analysis.util.CSVUtil; | ||
| import org.elasticsearch.ElasticsearchException; | ||
| import org.elasticsearch.ResourceNotFoundException; | ||
| import org.elasticsearch.action.support.PlainActionFuture; | ||
| import org.elasticsearch.common.Strings; | ||
| import org.elasticsearch.common.settings.Settings; | ||
|  | @@ -353,10 +355,23 @@ public static Reader getReaderFromFile(Environment env, String filePath, String | |
| } | ||
| } | ||
|  | ||
| public static Reader getReaderFromIndex(String synonymsSet, SynonymsManagementAPIService synonymsManagementAPIService) { | ||
| public static Reader getReaderFromIndex(String synonymsSet, SynonymsManagementAPIService synonymsManagementAPIService, boolean ignoreMissing) { | ||
| final PlainActionFuture<PagedResult<SynonymRule>> synonymsLoadingFuture = new PlainActionFuture<>(); | ||
| synonymsManagementAPIService.getSynonymSetRules(synonymsSet, synonymsLoadingFuture); | ||
| PagedResult<SynonymRule> results = synonymsLoadingFuture.actionGet(); | ||
|  | ||
| PagedResult<SynonymRule> results; | ||
| try { | ||
| results = synonymsLoadingFuture.actionGet(); | ||
| } catch (ResourceNotFoundException e) { | ||
| if (ignoreMissing == false) { | ||
| throw e; | ||
| } | ||
| logger.info( | ||
|          | ||
| "Synonyms set {} not found - synonyms will not be applied to search results on indices that use this synonym set", | ||
| synonymsSet | ||
| ); | ||
| results = new PagedResult<>(0, new SynonymRule[0]); | ||
| } | ||
|  | ||
| SynonymRule[] synonymRules = results.pageResults(); | ||
| StringBuilder sb = new StringBuilder(); | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -32,11 +32,14 @@ public class CreateIndexCapabilities { | |
|  | ||
| private static final String HUNSPELL_DICT_400 = "hunspell_dict_400"; | ||
|  | ||
| private static final String SYNONYMS_SET_LENIENT_ON_NON_EXISTING = "synonyms_set_lenient_on_non_existing"; | ||
|  | ||
| public static final Set<String> CAPABILITIES = Set.of( | ||
| LOGSDB_INDEX_MODE_CAPABILITY, | ||
| LOOKUP_INDEX_MODE_CAPABILITY, | ||
| NESTED_DENSE_VECTOR_SYNTHETIC_TEST, | ||
| POORLY_FORMATTED_BAD_REQUEST, | ||
| HUNSPELL_DICT_400 | ||
| HUNSPELL_DICT_400, | ||
| SYNONYMS_SET_LENIENT_ON_NON_EXISTING | ||
|          | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to this change, but a good opportunity to enable this test again