Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 1.62 KB

05_new_index_with_mapping.md

File metadata and controls

49 lines (40 loc) · 1.62 KB

Create index with mapping for entity

Entity is configured link and defined in php link and next thing is to get these settings to ElasticSearch.

Index creating

Variant 1. - No previous data

  • When to use?
  • You dont have any index, your ElasticSearch installation is clean and with no index for our entities.
  • How?
  • Entity is configured from previous step and we just need to run command.
php www/index spameri:elastic:initialize-index
  • Can be used for specific entity
php www/index spameri:elastic:initialize-index video

Variant 2. - Deleting previous data

  • When to use?
  • You have existing index with outdated data with old configuration, but you dont need to keep them. This is usually when you are generating ElasticSearch data from another database.
  • How?
  • Just add -f option. First thing command does is delete old index, then creating new empty index with new settings.
php www/index spameri:elastic:initialize-index -f
  • Can be used for specific entity
php www/index spameri:elastic:initialize-index -f video

Variant 3. - Preserving previous data

  • When to use?
  • You dont have source for data saved in ElasticSearch.
  • Best is backup your data with command. This creates bulk json document with all data from index.
php www/index spameri:elastic:dump-index
  • With data backed up, now you can delete index and create it fresh with new mapping - following variant 2.
  • Last thing is get your old data to new index wit this command.
php www/index spameri:elastic:restore-index