abetzi/elasticsearch-migrate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abetzi/elasticsearch-migrate

Composer 安装命令:

composer require abetzi/elasticsearch-migrate

包简介

README 文档

README

Simple elasticsearch indices manipulation for laravel framework.

Basic Usage

artisan es:index:info              Show info on given index and its related aliases
artisan es:template:create         Create elasticsearch template from given yaml file
artisan scout:delete-all-indexes   Delete all indexes
artisan scout:delete-index         Delete an index
artisan scout:flush                Flush all of the models records from the index
artisan scout:import               Import the given model into the search index
artisan scout:index                Create an index
artisan about                       Info about elasticsearch connection
SCOUT_DRIVER=elasticsearch

ELASTICSEARCH_HOST=localhost:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=elastic
ELASTICSEARCH_SSL_VERIFICATION=false

Install - as git submodule for development purpose

First - download source files

git submodule add git@bitbucket.org:puntik/elasticsearch-migrate.git

Install required libraries

composer install elasticsearch/elasticsearch
composer install laravel/scout

Then inject provider into config/app.php

<?php
[
  'providers' => [
      // ...
      /*
       * Package Service Providers...
       */
      Abetzi\Elasticsearch\Providers\ElasticsearchProvider::class,
    ],
]

Do not forget add autoload psr-4 mapping into composer.json.

{
    "autoload": {
        "psr-4": {
            "Abetzi\\Elasticsearch\\": "src/elasticsearch-migrate/src/"
        }
    }
}

Configure config/services.php

<?php
return [
    // ... 
    'elasticsearch' => [
        'hosts'    => explode(',', env('ELASTICSEARCH_HOST', 'https://host.docker.internal:9210')),
        'username' => env('ELASTICSEARCH_USERNAME', 'elastic'),
        'password' => env('ELASTICSEARCH_PASSWORD', 'elastic'),
        'ssl_verification' => env('ELASTICSEARCH_SSL_VERIFICATION', true)
    ],
];

Install - composer

Not finished yet.

  • composer install ...
  • config .env
  • artisan publish ...
  • it should work

Use case - index management

  • [x] Chci zalozit novy index s poradovym cislem podle vzoru {alias_name}-000001, alias neexistuje
  • [x] Chci zalozit novy index s poradovym cislem podle vzoru {alias_name}-000001, odebrat stare aliasy a nastavit novy alias.
  • [x] Chci nacist yaml s template a ulozit do indexu
  • [ ] Chci smazat index, na ktery je pripojeny alias {alias_name}.
  • [ ] Chci smazat vsechny indexy s patternem {alias_name}-000001, na ktere nesmeruje alias {alias_name}
  • [ ] Chci vypsat vsechny informace o indexech a aliasech s patternem {name}

Todo:

  • [x] refaktorovat
  • [ ] parametrizovat
  • [x] rozepsat do service
  • [x] udelat providery
  • [x] udelat commandy
  • [ ] napsat navod
  • [ ] nasypat do packagest - pripravit composer.json
  • [ ] sepsat povidani na tema konfigurace klienta elasticsearch
  • [ ] scout:create-index - implemetnovat misto moji tridy
  • [ ] scout:delete-index - implementovat misto moji tridy

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-07-11