Skip to content
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

Indexing creates an index instead of the expected alias #370

Closed
kdambekalns opened this issue Feb 4, 2021 · 3 comments
Closed

Indexing creates an index instead of the expected alias #370

kdambekalns opened this issue Feb 4, 2021 · 3 comments
Assignees
Labels

Comments

@kdambekalns
Copy link
Member

When running nodeindex:build and no indexes exist at all, an index named foo-postfix is created. But instead of an alias foo pointing to that, an actual index foo is created and filled with data.

This leads to at least two problems:

@kdambekalns kdambekalns self-assigned this Feb 4, 2021
@kdambekalns
Copy link
Member Author

Observations so far, when no indices exist:

  • nodeindex:indexnode without the --postfix option creates a postfix-less index and no alias
  • used with --postfix it creates an index with the given postfix, but does not create an alias as I'd expect

@kdambekalns
Copy link
Member Author

Conclusion:

  • nodeindex:indexnode without --postfix should use an existing alias or create a new postfix (like nodeindex:build does) and set up the alias
  • nodeindex:indexnode with --postfix given should use that postfix and not change the alias, as that's probably intended when passing the postfix manually

Exptected aliases for index name foo-fb11fdde869d0a8fcfe00a2fd35c031d-1612539561':

  • foo
  • foo-1612539561
  • foo-fb11fdde869d0a8fcfe00a2fd35c031d

@kdambekalns
Copy link
Member Author

More observations: nodeindex:build does not set up aliases after creating fresh indexes until it deems the indexing complete. This is good, usually, since it allows for indexing "in the background", but obviously if no aliases exist at all, this is going to break:

beach@a4ca46c09d26:/application$ ./flow nodeindex:build --limit 1 --workspace live
Creating indices and apply mapping... Done (took 16.48 seconds)
Indexing nodes...   + Workspace "live" and dimensions "{"language":["en"]}" done. (Indexed 2 nodes)
+ Workspace "live" and dimensions "{"language":["de","en"]}" done. (Indexed 2 nodes)
Done (took 3.66 seconds)
Refresh indicies... Done (took 1.50 seconds)
Update aliases...   Elasticsearch request failed:
[POST http://:@acmecom_elasticsearch:9200/_aliases]: Array
(
    [root_cause] => Array
        (
            [0] => Array
                (
                    [type] => invalid_alias_name_exception
                    [reason] => Invalid alias name
[acmecom-e781f29c8dd927c09735547a848e3459], an index exists with the
same name as the alias
                    [index_uuid] => V8fA1j8pRVikhO-QsLHsPA
                    [index] => acmecom-e781f29c8dd927c09735547a848e3459
                )

        )

    [type] => invalid_alias_name_exception
    [reason] => Invalid alias name
[acmecom-e781f29c8dd927c09735547a848e3459], an index exists with the
same name as the alias
    [index_uuid] => V8fA1j8pRVikhO-QsLHsPA
    [index] => acmecom-e781f29c8dd927c09735547a848e3459
)

kdambekalns added a commit to kdambekalns/Flowpack.ElasticSearch.ContentRepositoryAdaptor that referenced this issue Feb 11, 2021
The command `nodeindex:build` does not set up aliases after creating
fresh indexes until it considers the indexing complete. This is good,
usually, since it allows for indexing "in the background". But if no
aliases exist at all, this is going to break.

This change fixes that by setting up aliases after creating (fresh)
indexes, if no aliases exist.

Fixes Flowpack#370
kdambekalns added a commit to kdambekalns/Flowpack.ElasticSearch.ContentRepositoryAdaptor that referenced this issue Feb 11, 2021
With this change running `nodeindex:indexnode`

- without `--postfix` uses existing aliases or creates a new postfix
  (like `nodeindex:build` does) and sets up aliases
- with `--postfix` given will use that postfix and not change aliases,
  as that's probably intended when passing the postfix manually

Fixes Flowpack#370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants