Last active
November 30, 2020 04:52
-
-
Save Phathdt/27dc223265b729a47f1b66cf3c1adbfa to your computer and use it in GitHub Desktop.
moira ES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM elasticsearch:7.7.1 | |
COPY elasticsearch-analysis-vietnamese-7.7.1.zip /usr/share/elasticsearch/ | |
RUN cd /usr/share/elasticsearch && \ | |
bin/elasticsearch-plugin install --batch file:///usr/share/elasticsearch/elasticsearch-analysis-vietnamese-7.7.1.zip && \ | |
bin/elasticsearch-plugin install --batch analysis-icu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*plugin ES* | |
requirement | |
``` | |
java -version | |
openjdk version "1.8.0_275" | |
OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~20.04-b01) | |
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode) | |
``` | |
fork 2 repo này về onpoint | |
https://github.com/Phathdt/vn-nlp-libraries -> đã update lên open jdk 1.8 | |
https://github.com/Phathdt/elasticsearch-analysis-vietnamese -> đã update lên elasticsearch 7.7.1 | |
cách build plugin https://duydo.me/how-to-build-elasticsearch-vietnamese-analysis-plugin | |
*Install ES plugin* | |
copy file plugin `elasticsearch-analysis-vietnamese-7.7.1.zip` lên server | |
``` | |
bin/elasticsearch-plugin install --batch file:///usr/share/elasticsearch/elasticsearch-analysis-vietnamese-7.7.1.zip | |
bin/elasticsearch-plugin install --batch analysis-icu | |
``` | |
note: update location file | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get tất cả alias | |
curl -XGET "http://elasticsearch:9200/_alias" | |
``` | |
{ | |
".kibana_task_manager_1" : { | |
"aliases" : { | |
".kibana_task_manager" : { } | |
} | |
}, | |
".apm-agent-configuration" : { | |
"aliases" : { } | |
}, | |
"products-1606709483809588" : { | |
"aliases" : { | |
"products" : { } | |
} | |
}, | |
"products-1606559591948546" : { | |
"aliases" : { } | |
}, | |
"my_index" : { | |
"aliases" : { } | |
}, | |
".apm-custom-link" : { | |
"aliases" : { } | |
}, | |
".kibana_1" : { | |
"aliases" : { | |
".kibana" : { } | |
} | |
} | |
} | |
``` | |
delete alias products | |
``` | |
curl -XDELETE "http://elasticsearch:9200/products-1606709483809588" | |
... | |
``` | |
vào trong container và chạy command sau | |
``` | |
alias HeraCore.Repo | |
alias HeraCore.Tools.ElasticSearch.Product.Store, as: ESProductStore | |
import Ecto.Query, only: [from: 2] | |
from( p in HeraCore.Data.Schema.Product.preload_active_products()) | |
|> Repo.all() | |
|> Enum.each(& ESProductStore.update_product_to_es(&1)) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment