Uploaded image for project: 'Spring Data Elasticsearch'
  1. Spring Data Elasticsearch
  2. DATAES-821

Fix code for adding an alias

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.7 (Moore SR7), 4.0 RC2 (Neumann)
    • Component/s: Core
    • Labels:
      None

      Description

      The code in addAlias is broken:

      	public IndicesAliasesRequest.AliasActions aliasAction(AliasQuery query, IndexCoordinates index) {
      		Assert.notNull(index, "No index defined for Alias");
      		Assert.notNull(query.getAliasName(), "No alias defined");
      		IndicesAliasesRequest.AliasActions aliasAction = IndicesAliasesRequest.AliasActions.add()
      				.alias(query.getAliasName()).index(index.getIndexName());
      
      		if (query.getFilterBuilder() != null) {
      			aliasAction.filter(query.getFilterBuilder());
      		} else if (query.getFilter() != null) {
      			aliasAction.filter(query.getFilter());
      		} else if (!StringUtils.isEmpty(query.getRouting())) {
      			aliasAction.routing(query.getRouting());
      		} else if (!StringUtils.isEmpty(query.getSearchRouting())) {
      			aliasAction.searchRouting(query.getSearchRouting());
      		} else if (!StringUtils.isEmpty(query.getIndexRouting())) {
      			aliasAction.indexRouting(query.getIndexRouting());
      		}
      		return aliasAction;
      	}
      
      

      It makes no sense to have this if-else cascading. For the first two ones - filter - yes, but not for the rest

        Attachments

          Activity

            People

            Assignee:
            sothawo sothawo
            Reporter:
            sothawo sothawo
            Last updater:
            Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: