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

CLI command behaviour unpredictable when run without --index option and multiple indices #966

Open
macghriogair opened this issue Sep 24, 2020 · 0 comments

Comments

@macghriogair
Copy link

macghriogair commented Sep 24, 2020

ONGR cli commands act on unpredictable indices when executed without --index option

  • Bundle Versions: 6.7.2 and 7.x
  • Elasticsearch Version: 6.7 and 7.6
  • PHP Version 7.4

Expected behaviour:

  • --index option should be either required OR commands should be executed on all indices (where possible)

Actual behaviour:

  • an unpredictable index is used when commands are executed without --index

Steps to reproduce:

Having mutliple indices + document classes:

config.yml

ongr_elasticsearch:
    # ...
    indexes:
            AppBundle\Search\Document\AcmeApple:
                alias: acme_apples
                hosts:
                    - '%elasticsearch.host%'
            AppBundle\Search\Document\AcmeBanana:
                alias: acme_banana
                hosts:
                    - '%elasticsearch.host%'
            AppBundle\Search\Document\AcmePotatoe:
                alias: acme_potatoe
                hosts:
                    - '%elasticsearch.host%'

Any of the following commands will be executed on just one index

  • ongr:es:cache:clear
  • ongr:es:index:create
  • ongr:es:index:drop
  • ongr:es:index:export
  • ongr:es:index:import

Console output:

# Drop indices
www-data@41995e1973b5:/php$ bin/console ongr:es:index:drop -f

 The index `acme_banana` was successfully dropped.
# Create indices
www-data@41995e1973b5:/php$ bin/console ongr:es:index:create

 Created `acme_banana` index.

# Clear cache
www-data@41995e1973b5:/php$ bin/console ongr:es:cache:clear

 [OK] Elasticsearch `acme_banana` index cache has been cleared.

# Export
 www-data@41995e1973b5:/php$ bin/console ongr:es:index:export foo.json
# foo contains data of index `acme_banana`
# and so on...

Our workaround is a bash script to loop over all indices for tasks such as mapping updates/cache clear/reindex etc.

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

No branches or pull requests

1 participant