{"id":86059,"date":"2025-04-22T09:31:08","date_gmt":"2025-04-22T02:31:08","guid":{"rendered":"https:\/\/itviecblog.uptech.vn\/?p=86059"},"modified":"2025-06-17T15:00:08","modified_gmt":"2025-06-17T08:00:08","slug":"cau-hoi-phong-van-elasticsearch","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/","title":{"rendered":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#Ai_can_nam_vung_cac_cau_hoi_phong_van_Elasticsearch\" >Ai c\u1ea7n n\u1eafm v\u1eefng c\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#Cac_cau_hoi_phong_van_Elasticsearch_co_ban\" >C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u01a1 b\u1ea3n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#Cac_cau_hoi_phong_van_Elasticsearch_cap_trung\" >C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p trung<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#Cac_cau_hoi_phong_van_Elasticsearch_cap_cao\" >C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p cao<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#Tong_ket_cau_hoi_phong_van_Elasticsearch\" >T\u1ed5ng k\u1ebft c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch<\/a><\/li><\/ul><\/nav><\/div>\n<p><em><strong>B\u1ea1n \u0111ang chu\u1ea9n b\u1ecb \u1ee9ng tuy\u1ec3n m\u1ed9t v\u1ecb tr\u00ed y\u00eau c\u1ea7u ki\u1ebfn th\u1ee9c v\u1ec1 Elasticsearch? B\u00e0i vi\u1ebft n\u00e0y ch\u00ednh l\u00e0 \u201ctuy\u1ec7t chi\u00eau\u201d chinh ph\u1ee5c nh\u00e0 tuy\u1ec3n d\u1ee5ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9. T\u1eeb nh\u1eefng ki\u1ebfn th\u1ee9c n\u1ec1n t\u1ea3ng \u0111\u1ebfn k\u1ef9 n\u0103ng x\u1eed l\u00fd truy v\u1ea5n ph\u1ee9c t\u1ea1p, ITviec s\u1ebd gi\u00fap b\u1ea1n t\u1ef1 tin n\u1eafm b\u1eaft c\u01a1 h\u1ed9i s\u1ef1 nghi\u1ec7p trong l\u0129nh v\u1ef1c d\u1eef li\u1ec7u. B\u00e0i vi\u1ebft c\u0169ng l\u00e0 ngu\u1ed3n t\u00e0i li\u1ec7u tham kh\u1ea3o h\u1eefu \u00edch cho nh\u1eefng ai mu\u1ed1n n\u00e2ng cao ki\u1ebfn th\u1ee9c v\u1ec1 Elasticsearch.<\/strong><\/em><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ecdc b\u00e0i vi\u1ebft \u0111\u1ec3 hi\u1ec3u h\u01a1n v\u1ec1:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Nh\u1eefng ng\u01b0\u1eddi c\u1ea7n n\u1eafm v\u1eefng c\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u01a1 b\u1ea3n;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p trung;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p cao.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Ai_can_nam_vung_cac_cau_hoi_phong_van_Elasticsearch\"><\/span><b>Ai c\u1ea7n n\u1eafm v\u1eefng c\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">C\u00e1c v\u1ecb tr\u00ed c\u1ea7n trau d\u1ed3i ki\u1ebfn th\u1ee9c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><a href=\"\/blog\/data-analyst-lam-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Data Analyst<\/strong><\/a>: Gi\u00fap truy xu\u1ea5t v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u hi\u1ec7u qu\u1ea3, cho ph\u00e9p th\u1ef1c hi\u1ec7n c\u00e1c truy v\u1ea5n t\u00ecm ki\u1ebfm n\u00e2ng cao, th\u1ef1c hi\u1ec7n t\u1ed5ng h\u1ee3p v\u00e0 r\u00fat ra hi\u1ec3u bi\u1ebft c\u00f3 \u00fd ngh\u0129a t\u1eeb c\u00e1c t\u1eadp d\u1eef li\u1ec7u l\u1edbn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Data Scientist<\/strong>: D\u1ef1a v\u00e0o kh\u1ea3 n\u0103ng t\u00ecm ki\u1ebfm m\u1ea1nh m\u1ebd c\u1ee7a Elasticsearch \u0111\u1ec3 kh\u00e1m ph\u00e1 v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u, th\u1ef1c hi\u1ec7n c\u00e1c truy v\u1ea5n ph\u1ee9c t\u1ea1p, t\u1eadn d\u1ee5ng t\u1ed5ng h\u1ee3p \u0111\u1ec3 ph\u00e2n t\u00edch th\u1ed1ng k\u00ea v\u00e0 x\u00e2y d\u1ef1ng c\u00e1c c\u00f4ng c\u1ee5 t\u00ecm ki\u1ebfm hi\u1ec7u qu\u1ea3 cho c\u00e1c h\u1ec7 th\u1ed1ng \u0111\u1ec1 xu\u1ea5t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><a href=\"\/blog\/data-engineer-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Data Engineer<\/strong><\/a>: Ki\u1ebfn tr\u00fac ph\u00e2n t\u00e1n v\u00e0 kh\u1ea3 n\u0103ng t\u00ecm ki\u1ebfm to\u00e0n v\u0103n b\u1ea3n c\u1ee7a Elasticsearch khi\u1ebfn \u0111\u00e2y tr\u1edf th\u00e0nh c\u00f4ng c\u1ee5 c\u00f3 gi\u00e1 tr\u1ecb \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a hi\u1ec7u su\u1ea5t l\u1eadp index d\u1eef li\u1ec7u v\u00e0 truy v\u1ea5n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Analytics Engineer<\/strong>: Chuy\u00ean m\u00f4n c\u1ee7a Analytics Engineer v\u1ec1 Elasticsearch cho ph\u00e9p b\u1ea1n thi\u1ebft k\u1ebf, x\u00e2y d\u1ef1ng v\u00e0 qu\u1ea3n l\u00fd hi\u1ec7u qu\u1ea3 c\u00e1c Elasticsearch cluster, \u0111\u1ea3m b\u1ea3o hi\u1ec7u su\u1ea5t v\u00e0 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng t\u1ed1i \u01b0u cho vi\u1ec7c kh\u00e1m ph\u00e1 v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><a href=\"\/blog\/ai-engineer-roadmap\/\" target=\"_blank\" rel=\"noopener\"><strong>AI Engineer<\/strong><\/a>: T\u1eadn d\u1ee5ng Elasticsearch \u0111\u1ec3 t\u0103ng c\u01b0\u1eddng kh\u1ea3 n\u0103ng truy xu\u1ea5t th\u00f4ng tin, th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm ng\u1eef ngh\u0129a v\u00e0 t\u1ea1o ra c\u00e1c chatbot th\u00f4ng minh ho\u1eb7c tr\u1ee3 l\u00fd \u1ea3o, gi\u00fap x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng th\u00f4ng minh \u0111\u00f2i h\u1ecfi ch\u1ee9c n\u0103ng t\u00ecm ki\u1ebfm ph\u1ee9c t\u1ea1p.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Data Architect<\/strong>: S\u1ef1 th\u00e0nh th\u1ea1o trong Elasticsearch cho ph\u00e9p b\u1ea1n k\u1ebft h\u1ee3p Elasticsearch nh\u01b0 m\u1ed9t th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i \u0111\u1ec3 t\u0103ng kh\u1ea3 n\u0103ng t\u00ecm ki\u1ebfm hi\u1ec7u qu\u1ea3 v\u00e0 kh\u00e1m ph\u00e1 d\u1eef li\u1ec7u trong c\u00e1c gi\u1ea3i ph\u00e1p ki\u1ebfn \u200b\u200btr\u00fac.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>GIS Data Analyst<\/strong>: C\u00e1c t\u00ednh n\u0103ng kh\u00f4ng gian \u0111\u1ecba l\u00fd c\u1ee7a Elasticsearch gi\u00fap ph\u00e2n t\u00edch v\u00e0 truy v\u1ea5n d\u1eef li\u1ec7u \u0111\u1ecbnh v\u1ecb \u0111\u1ecba l\u00fd. B\u1ea1n c\u00f3 th\u1ec3 t\u1eadn d\u1ee5ng c\u00e1c ch\u1ee9c n\u0103ng n\u00e0y \u0111\u1ec3 th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm kh\u00f4ng gian \u0111\u1ecba l\u00fd, ph\u00e2n t\u00edch v\u1ecb tr\u00ed g\u1ea7n v\u00e0 tr\u1ef1c quan h\u00f3a tr\u00ean c\u00e1c t\u1eadp d\u1eef li\u1ec7u kh\u00f4ng gian.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Machine Learning Engineer<\/strong>: S\u1eed d\u1ee5ng Elasticsearch \u0111\u1ec3 l\u01b0u tr\u1eef v\u00e0 t\u00ecm ki\u1ebfm c\u00e1c t\u1eadp d\u1eef li\u1ec7u l\u1edbn nh\u1eb1m \u0111\u00e0o t\u1ea1o v\u00e0 tri\u1ec3n khai c\u00e1c m\u00f4 h\u00ecnh h\u1ecdc m\u00e1y. Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 t\u00ecm ki\u1ebfm hi\u1ec7u qu\u1ea3 c\u1ee7a Elasticsearch s\u1ebd l\u00e0 c\u00f4ng c\u1ee5 gi\u00e1 tr\u1ecb \u0111\u1ec3 qu\u1ea3n l\u00fd v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u \u0111\u00e0o t\u1ea1o.<\/span><\/li>\n<\/ul>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/ai-engineer-vs-data-scientist\/\" target=\"_blank\" rel=\"noopener\"><strong>AI Engineer vs Data Scientist: Ph\u00e2n bi\u1ec7t qua 4 \u0111i\u1ec3m quan tr\u1ecdng<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_phong_van_Elasticsearch_co_ban\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u01a1 b\u1ea3n<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>Elasticsearch ho\u1ea1t \u0111\u1ed9ng nh\u01b0 th\u1ebf n\u00e0o?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch s\u1eed d\u1ee5ng Apache Lucene l\u00e0m n\u1ec1n t\u1ea3ng b\u00ean d\u01b0\u1edbi \u0111\u1ec3 l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u. D\u1eef li\u1ec7u khi \u0111\u01b0\u1ee3c ti\u1ebfp nh\u1eadn s\u1ebd \u0111\u01b0\u1ee3c ph\u00e2n t\u00edch, chu\u1ea9n h\u00f3a v\u00e0 l\u01b0u tr\u1eef trong c\u00e1c c\u1ea5u tr\u00fac inverted index, cho ph\u00e9p t\u00ecm ki\u1ebfm nhanh ch\u00f3ng.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u0110\u1ea7u ti\u00ean, d\u1eef li\u1ec7u th\u00f4 \u0111\u01b0\u1ee3c thu th\u1eadp t\u1eeb nhi\u1ec1u ngu\u1ed3n kh\u00e1c nhau, ch\u1eb3ng h\u1ea1n nh\u01b0 t\u1ec7p nh\u1eadt k\u00fd, s\u1ed1 li\u1ec7u h\u1ec7 th\u1ed1ng ho\u1eb7c \u1ee9ng d\u1ee5ng web. Beats l\u00e0 c\u00e1c t\u00e1c nh\u00e2n v\u1eadn chuy\u1ec3n d\u1eef li\u1ec7u nh\u1eb9 (data shipper) thu th\u1eadp c\u00e1c lo\u1ea1i d\u1eef li\u1ec7u kh\u00e1c nhau v\u00e0 chuy\u1ec3n ti\u1ebfp \u0111\u1ebfn Logstash.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">D\u1eef li\u1ec7u th\u00f4 n\u00e0y \u0111\u01b0\u1ee3c chu\u1ea9n h\u00f3a, ph\u00e2n t\u00edch v\u00e0 l\u00e0m gi\u00e0u d\u1eef li\u1ec7u tr\u01b0\u1edbc khi \u0111\u01b0\u1ee3c l\u1eadp index trong Elasticsearch. Logstash th\u1ef1c hi\u1ec7n m\u1ed9t s\u1ed1 chuy\u1ec3n \u0111\u1ed5i v\u00e0 c\u1ea3i ti\u1ebfn, sau \u0111\u00f3 g\u1eedi d\u1eef li\u1ec7u \u0111\u1ec3 l\u1eadp index trong Elasticsearch.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ngay sau khi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u1eadp index, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 ch\u1ea1y truy v\u1ea5n tr\u00ean d\u1eef li\u1ec7u \u0111\u00f3, sau \u0111\u00f3 t\u1ed5ng h\u1ee3p \u0111\u1ec3 t\u1ea1o ra th\u00f4ng tin chi ti\u1ebft. Elasticsearch cho ph\u00e9p b\u1ea1n l\u01b0u tr\u1eef, t\u00ecm ki\u1ebfm v\u00e0 ph\u00e2n t\u00edch l\u01b0\u1ee3ng d\u1eef li\u1ec7u kh\u1ed5ng l\u1ed3 ho\u1eb7c c\u1ef1c l\u1edbn g\u1ea7n nh\u01b0 theo th\u1eddi gian th\u1ef1c, cung c\u1ea5p k\u1ebft qu\u1ea3 trong mili gi\u00e2y.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Cu\u1ed1i c\u00f9ng, t\u1eeb Kibana, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 t\u1ea1o ra h\u00ecnh \u1ea3nh tr\u1ef1c quan m\u1ea1nh m\u1ebd v\u1ec1 d\u1eef li\u1ec7u v\u00e0 h\u00ecnh \u1ea3nh h\u00f3a c\u00e1c truy v\u1ea5n ph\u1ee9c t\u1ea1p th\u00f4ng qua s\u01a1 \u0111\u1ed3 t\u01b0\u01a1ng t\u00e1c, d\u1eef li\u1ec7u kh\u00f4ng gian \u0111\u1ecba l\u00fd v\u00e0 \u0111\u1ed3 th\u1ecb.<\/span><\/li>\n<\/ul>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/elasticsearch-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>T\u1eeb A \u0111\u1ebfn Z v\u1ec1 Elasticsearch: \u201cV\u0169 kh\u00ed\u201d b\u00ed m\u1eadt cho c\u00e1c \u1ee9ng d\u1ee5ng d\u1eef li\u1ec7u l\u1edbn<\/strong><\/a><\/em><\/p><\/blockquote>\n<h3><b>Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng l\u00e0m g\u00ec, ki\u1ebfn tr\u00fac c\u01a1 b\u1ea3n c\u1ee7a Elasticsearch nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ki\u1ebfn tr\u00fac c\u01a1 b\u1ea3n c\u1ee7a Elasticsearch bao g\u1ed3m c\u00e1c node, t\u1ea1o th\u00e0nh c\u00e1c cluster v\u00e0 ph\u00e2n ph\u1ed1i d\u1eef li\u1ec7u tr\u00ean c\u00e1c shard \u0111\u1ec3 c\u00f3 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 ph\u1ee5c h\u1ed3i. Elasticsearch s\u1eed d\u1ee5ng c\u1ea5u tr\u00fac inverted index \u0111\u1ec3 truy xu\u1ea5t d\u1eef li\u1ec7u hi\u1ec7u qu\u1ea3. Elasticsearch l\u00e0 m\u1ed9t c\u01a1 s\u1edf d\u1eef li\u1ec7u ph\u00e2n t\u00e1n, \u0111i\u1ec1u n\u00e0y c\u00f3 ngh\u0129a l\u00e0 c\u00e1c index \u0111\u01b0\u1ee3c chia th\u00e0nh c\u00e1c shard v\u00e0 \u0111\u01b0\u1ee3c ph\u00e2n ph\u1ed1i tr\u00ean nhi\u1ec1u node trong m\u1ed9t cluster. M\u1ed7i node ch\u1ee9a m\u1ed9t ph\u1ea7n c\u1ee7a d\u1eef li\u1ec7u, cho ph\u00e9p x\u1eed l\u00fd song song v\u00e0 cung c\u1ea5p kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng theo chi\u1ec1u ngang.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong m\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p nh\u01b0:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u00ecm ki\u1ebfm to\u00e0n v\u0103n: Elasticsearch gi\u00fap c\u00e1c truy v\u1ea5n t\u00ecm ki\u1ebfm ph\u1ee9c t\u1ea1p tr\u1edf n\u00ean d\u1ec5 d\u00e0ng h\u01a1n b\u1eb1ng c\u00e1ch t\u00ecm ki\u1ebfm nhanh ch\u00f3ng tr\u00ean c\u00e1c t\u1eadp d\u1eef li\u1ec7u l\u1edbn. T\u00ednh n\u0103ng n\u00e0y \u0111\u1eb7c bi\u1ec7t h\u1eefu \u00edch cho c\u00e1c trang web, \u1ee9ng d\u1ee5ng ho\u1eb7c doanh nghi\u1ec7p y\u00eau c\u1ea7u k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm t\u1ee9c th\u1eddi.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ph\u00e2n t\u00edch d\u1eef li\u1ec7u nh\u1eadt k\u00fd v\u00e0 s\u1ef1 ki\u1ec7n: Elasticsearch gi\u00fap ph\u00e2n t\u00edch nhanh d\u1eef li\u1ec7u nh\u1eadt k\u00fd, s\u1ef1 ki\u1ec7n h\u1ec7 th\u1ed1ng v\u00e0 s\u1ef1 ki\u1ec7n \u1ee9ng d\u1ee5ng, c\u1ea3i thi\u1ec7n kh\u1ea3 n\u0103ng gi\u00e1m s\u00e1t h\u1ec7 th\u1ed1ng v\u00e0 x\u00e1c \u0111\u1ecbnh s\u1ef1 c\u1ed1.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ph\u00e1t hi\u1ec7n b\u1ea5t th\u01b0\u1eddng: Ph\u00e1t hi\u1ec7n c\u00e1c m\u00f4 h\u00ecnh b\u1ea5t th\u01b0\u1eddng, ch\u1eb3ng h\u1ea1n nh\u01b0 ho\u1ea1t \u0111\u1ed9ng gian l\u1eadn, t\u1ea5n c\u00f4ng m\u1ea1ng ho\u1eb7c s\u1ef1 c\u1ed1 hi\u1ec7u su\u1ea5t, b\u1eb1ng c\u00e1ch ph\u00e2n t\u00edch d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef theo th\u1eddi gian th\u1ef1c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Tr\u1ef1c quan h\u00f3a d\u1eef li\u1ec7u: Elasticsearch c\u00f3 th\u1ec3 k\u1ebft h\u1ee3p v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c nh\u01b0 Kibana \u0111\u1ec3 t\u1ea1o tr\u1ef1c quan h\u00f3a d\u1eef li\u1ec7u t\u01b0\u01a1ng t\u00e1c. \u0110i\u1ec1u n\u00e0y gi\u00fap kh\u00e1m ph\u00e1, hi\u1ec3u v\u00e0 s\u1eed d\u1ee5ng d\u1eef li\u1ec7u hi\u1ec7u qu\u1ea3 d\u1ec5 d\u00e0ng h\u01a1n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Theo d\u00f5i s\u1ed1 li\u1ec7u v\u00e0 hi\u1ec7u su\u1ea5t: Elasticsearch gi\u00fap thu th\u1eadp, ph\u00e2n t\u00edch v\u00e0 tr\u1ef1c quan h\u00f3a c\u00e1c s\u1ed1 li\u1ec7u hi\u1ec7u su\u1ea5t nh\u01b0 th\u1eddi gian ph\u1ea3n h\u1ed3i v\u00e0 t\u1ea3i h\u1ec7 th\u1ed1ng, h\u1ed7 tr\u1ee3 t\u1ed1i \u01b0u h\u00f3a h\u1ec7 th\u1ed1ng v\u00e0 l\u1eadp k\u1ebf ho\u1ea1ch n\u0103ng l\u1ef1c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ef1 \u0111\u1ed9ng ho\u00e0n th\u00e0nh v\u00e0 s\u1eeda l\u1ed7i ch\u00ednh t\u1ea3: Elasticsearch c\u00f3 th\u1ec3 cung c\u1ea5p t\u00ednh n\u0103ng t\u1ef1 \u0111\u1ed9ng ho\u00e0n th\u00e0nh v\u00e0 s\u1eeda l\u1ed7i ch\u00ednh t\u1ea3 theo th\u1eddi gian th\u1ef1c trong khi ng\u01b0\u1eddi d\u00f9ng t\u00ecm ki\u1ebfm, n\u00e2ng cao tr\u1ea3i nghi\u1ec7m c\u1ee7a ng\u01b0\u1eddi d\u00f9ng v\u00e0 gi\u00fap t\u00ecm ki\u1ebfm hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u00ecm ki\u1ebfm theo kh\u00f4ng gian \u0111\u1ecba l\u00fd: Elasticsearch h\u1ed7 tr\u1ee3 t\u00ecm ki\u1ebfm v\u00e0 l\u1ecdc d\u1eef li\u1ec7u d\u1ef1a tr\u00ean v\u1ecb tr\u00ed \u0111\u1ecba l\u00fd, cho ph\u00e9p t\u00ecm ki\u1ebfm theo kho\u1ea3ng c\u00e1ch v\u00e0 ph\u00e2n t\u00edch theo v\u1ecb tr\u00ed.<\/span><\/li>\n<\/ul>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/huong-dan-elasticsearch-tutorial\/\" target=\"_blank\" rel=\"noopener\"><strong>Elasticsearch tutorial: Chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng Elasticsearch c\u01a1 b\u1ea3n<\/strong><\/a><\/em><\/p><\/blockquote>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 t\u1ea1o, x\u00f3a, li\u1ec7t k\u00ea v\u00e0 truy v\u1ea5n Index trong Elasticsearch?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh t\u1ea1o index m\u1edbi:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/test_index?pretty<\/span><\/pre>\n<p><span style=\"font-weight: 400;\"><a href=\"\/blog\/huong-dan-delete-index-elasticsearch\/\" target=\"_blank\" rel=\"noopener\"><strong>L\u1ec7nh x\u00f3a index<\/strong><\/a>:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">DELETE \/test_index?pretty<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 t\u00ean index v\u00e0 th\u00f4ng tin c\u01a1 b\u1ea3n c\u1ee7a ch\u00fang:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET _cat\/indices?v<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh truy v\u1ea5n m\u1ed9t index:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET test_index\/_search<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh truy v\u1ea5n nhi\u1ec1u index:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET test_index1, test_index2\/_search<\/span><\/pre>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/elasticsearch-query-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Elasticsearch Query: Kh\u00e1m ph\u00e1 b\u00ed k\u00edp t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u si\u00eau t\u1ed1c<\/strong><\/a><\/em><\/p><\/blockquote>\n<h3><b> L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 th\u00eam \u00e1nh x\u1ea1 v\u00e0o index?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch cho ph\u00e9p b\u1ea1n th\u00eam \u00e1nh x\u1ea1 v\u00e0o m\u1ed9t index d\u1ef1a tr\u00ean d\u1eef li\u1ec7u do ng\u01b0\u1eddi d\u00f9ng cung c\u1ea5p trong n\u1ed9i dung y\u00eau c\u1ea7u. C\u00fa ph\u00e1p nh\u01b0 sau:\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/&lt;index_name&gt;\/_mapping<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\n<span style=\"font-weight: 400;\">\"field_name\": { \"type\": \"text\" }<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>ElasticSearch Mapping l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch Mapping l\u00e0 qu\u00e1 tr\u00ecnh x\u00e1c \u0111\u1ecbnh c\u00e1ch l\u01b0u tr\u1eef v\u00e0 l\u1eadp index c\u00e1c t\u00e0i li\u1ec7u v\u00e0 tr\u01b0\u1eddng c\u1ee7a ch\u00fang trong Elasticsearch index. Mapping bao g\u1ed3m vi\u1ec7c thi\u1ebft l\u1eadp c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u (v\u00ed d\u1ee5: v\u0103n b\u1ea3n, t\u1eeb kh\u00f3a, ng\u00e0y) v\u00e0 c\u1ea5u h\u00ecnh c\u00e1c tr\u00ecnh ph\u00e2n t\u00edch.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"mappings\": {<\/span>\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\"title\": { \"type\": \"text\" },<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\"date\": { \"type\": \"date\" },<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\"views\": { \"type\": \"integer\" }<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>Gi\u1ea3i th\u00edch c\u00e1c thu\u1eadt ng\u1eef Shard v\u00e0 Replica trong Elasticsearch<\/b><\/h3>\n<h4><b>Kh\u00e1i ni\u1ec7m Shard<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Elasticsearch th\u01b0\u1eddng b\u1ecb s\u1eadp do c\u00e1c index l\u1edbn. Do s\u1ed1 l\u01b0\u1ee3ng t\u00e0i li\u1ec7u kh\u00f4ng gi\u1edbi h\u1ea1n \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef tr\u00ean m\u1ed7i index, m\u1ed9t index c\u00f3 th\u1ec3 chi\u1ebfm nhi\u1ec1u dung l\u01b0\u1ee3ng \u0111\u0129a h\u01a1n so v\u1edbi kh\u1ea3 n\u0103ng l\u01b0u tr\u1eef c\u1ee7a m\u00e1y ch\u1ee7. Vi\u1ec7c l\u1eadp index s\u1ebd b\u1eaft \u0111\u1ea7u b\u1ecb l\u1ed7i ngay khi index \u0111\u1ea1t \u0111\u1ebfn gi\u1edbi h\u1ea1n l\u01b0u tr\u1eef.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 gi\u1ea3i quy\u1ebft v\u1ea5n \u0111\u1ec1 n\u00e0y, c\u00f3 th\u1ec3 chia ho\u1eb7c ph\u00e2n \u0111o\u1ea1n c\u00e1c index theo chi\u1ec1u ngang th\u00e0nh nhi\u1ec1u ph\u1ea7n, \u0111\u01b0\u1ee3c g\u1ecdi l\u00e0 shard. \u0110\u1ed1i v\u1edbi m\u1ed9t index, b\u1ea1n c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng ch\u1ec9 \u0111\u1ecbnh s\u1ed1 l\u01b0\u1ee3ng shard m\u00e0 b\u1ea1n mu\u1ed1n. Do \u0111\u00f3, m\u1ed7i shard l\u00e0 &#8220;index&#8221; ri\u00eang v\u1edbi \u0111\u1ea7y \u0111\u1ee7 ch\u1ee9c n\u0103ng v\u00e0 ho\u1ea1t \u0111\u1ed9ng \u0111\u1ed9c l\u1eadp, c\u00f3 th\u1ec3 ch\u1ea1y tr\u00ean b\u1ea5t k\u1ef3 node n\u00e0o trong cluster.<\/span><\/p>\n<h4><b>Kh\u00e1i ni\u1ec7m Replica<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Replica (b\u1ea3n sao) l\u00e0 c\u01a1 ch\u1ebf an to\u00e0n l\u1ed7i c\u1ee7a Elasticsearch, b\u1ea3n sao c\u00e1c shard c\u1ee7a index. Replica c\u00f3 th\u1ec3 h\u1eefu \u00edch khi m\u1ed9t node g\u1eb7p s\u1ef1 c\u1ed1. H\u01a1n n\u1eefa, replica c\u00f3 th\u1ec3 ph\u1ee5c v\u1ee5 c\u00e1c y\u00eau c\u1ea7u \u0111\u1ecdc, \u0111i\u1ec1u n\u00e0y h\u1eefu \u00edch \u0111\u1ec3 t\u0103ng hi\u1ec7u su\u1ea5t t\u00ecm ki\u1ebfm. \u0110\u1ec3 \u0111\u1ea3m b\u1ea3o t\u00ednh kh\u1ea3 d\u1ee5ng cao, replica\u00a0 kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1eb7t tr\u00ean c\u00f9ng m\u1ed9t node v\u1edbi shard g\u1ed1c m\u00e0 ch\u00fang \u0111\u01b0\u1ee3c sao l\u01b0u.<\/span><\/p>\n<h3><b>Gi\u1ea3i th\u00edch c\u00e1c thu\u1eadt ng\u1eef Document v\u00e0 Cluster trong Elasticsearch<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Cluster l\u00e0 t\u1eadp h\u1ee3p c\u00e1c node \u0111\u01b0\u1ee3c k\u1ebft n\u1ed1i. N\u1ebfu b\u1ea1n ch\u1ec9 ch\u1ea1y m\u1ed9t phi\u00ean b\u1ea3n ho\u1eb7c node c\u1ee7a Elasticsearch, b\u1ea1n s\u1ebd c\u00f3 m\u1ed9t node cluster \u0111\u01a1n ho\u1eb7c m\u1ed9t cluster g\u1ed3m m\u1ed9t node. C\u00e1c cluster t\u1ef1 \u0111\u1ed9ng s\u1eafp x\u1ebfp l\u1ea1i khi c\u00e1c node tham gia ho\u1eb7c r\u1eddi \u0111i \u0111\u1ec3 d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c ph\u00e2n ph\u1ed1i \u0111\u1ec1u gi\u1eefa t\u1ea5t c\u1ea3 c\u00e1c node. M\u1eb7c d\u00f9 ho\u1ea1t \u0111\u1ed9ng \u0111\u1ea7y \u0111\u1ee7, cluster v\u1eabn c\u00f3 nguy c\u01a1 m\u1ea5t d\u1eef li\u1ec7u n\u1ebfu x\u1ea3y ra l\u1ed7i.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed9t Document (t\u00e0i li\u1ec7u) trong Elasticsearch l\u00e0 m\u1ed9t \u0111\u01a1n v\u1ecb th\u00f4ng tin c\u01a1 b\u1ea3n c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c l\u1eadp index, l\u01b0u tr\u1eef v\u00e0 t\u00ecm ki\u1ebfm. C\u00e1c t\u00e0i li\u1ec7u \u0111\u01b0\u1ee3c th\u1ec3 hi\u1ec7n trong JSON &#8211; \u0111\u1ecbnh d\u1ea1ng m\u00e0 con ng\u01b0\u1eddi c\u00f3 th\u1ec3 \u0111\u1ecdc \u0111\u01b0\u1ee3c v\u00e0 m\u00e1y c\u00f3 th\u1ec3 ph\u00e2n t\u00edch \u0111\u01b0\u1ee3c. M\u1ed7i t\u00e0i li\u1ec7u bao g\u1ed3m m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c tr\u01b0\u1eddng c\u00f3 gi\u00e1 tr\u1ecb t\u01b0\u01a1ng \u1ee9ng, c\u00f3 th\u1ec3 l\u00e0 nhi\u1ec1u ki\u1ec3u d\u1eef li\u1ec7u kh\u00e1c nhau nh\u01b0 v\u0103n b\u1ea3n, s\u1ed1, ng\u00e0y th\u00e1ng, v\u1ecb tr\u00ed \u0111\u1ecba l\u00fd ho\u1eb7c gi\u00e1 tr\u1ecb boolean.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed7i Document trong Elasticsearch \u0111\u01b0\u1ee3c \u0111\u1ecbnh danh b\u1eb1ng m\u1ed9t ID duy nh\u1ea5t v\u00e0 \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong m\u1ed9t index c\u1ee5 th\u1ec3. C\u00e1c Document c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c c\u1eadp nh\u1eadt, truy xu\u1ea5t ho\u1eb7c x\u00f3a b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng ID c\u1ee7a ch\u00fang.<\/span><\/p>\n<h3><b>Node trong Elasticsearch l\u00e0 g\u00ec? C\u00f3 nh\u1eefng lo\u1ea1i node n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">M\u1ed9t node trong Elasticsearch \u0111\u1ec1 c\u1eadp \u0111\u1ebfn m\u1ed9t phi\u00ean b\u1ea3n ch\u1ea1y duy nh\u1ea5t c\u1ee7a quy tr\u00ecnh Elasticsearch trong m\u1ed9t cluster. Node \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef d\u1eef li\u1ec7u v\u00e0 tham gia v\u00e0o kh\u1ea3 n\u0103ng l\u1eadp index c\u0169ng nh\u01b0 t\u00ecm ki\u1ebfm c\u1ee7a cluster. C\u00e1c node giao ti\u1ebfp v\u1edbi nhau \u0111\u1ec3 ph\u00e2n ph\u1ed1i d\u1eef li\u1ec7u v\u00e0 kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c, \u0111\u1ea3m b\u1ea3o cluster c\u00e2n b\u1eb1ng v\u00e0 hi\u1ec7u su\u1ea5t cao. C\u00e1c node c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh v\u1edbi vai tr\u00f2 kh\u00e1c nhau trong cluster.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">B\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng c\u00e1c node, Elasticsearch c\u00f3 th\u1ec3 m\u1edf r\u1ed9ng quy m\u00f4 \u0111\u1ec3 x\u1eed l\u00fd l\u01b0\u1ee3ng l\u1edbn d\u1eef li\u1ec7u v\u00e0 l\u01b0u l\u01b0\u1ee3ng truy c\u1eadp. C\u00e1c node \u0111\u01b0\u1ee3c th\u00eam v\u00e0o cluster khi c\u1ea7n v\u00e0 x\u00f3a \u0111i m\u00e0 kh\u00f4ng \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn t\u00ednh kh\u1ea3 d\u1ee5ng c\u1ee7a d\u1eef li\u1ec7u. Do \u0111\u00f3, Elasticsearch tr\u1edf th\u00e0nh gi\u1ea3i ph\u00e1p c\u00f3 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 \u0111\u00e1ng tin c\u1eady cao \u0111\u1ec3 l\u01b0u tr\u1eef v\u00e0 t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh vai tr\u00f2 cho c\u00e1c node b\u1eb1ng c\u00e1ch thi\u1ebft l\u1eadp <\/span><span style=\"font-weight: 400;\">node.roles<\/span><span style=\"font-weight: 400;\"> trong <\/span><span style=\"font-weight: 400;\">Elasticsearch.yml<\/span><span style=\"font-weight: 400;\">. N\u1ebfu b\u1ea1n kh\u00f4ng thi\u1ebft l\u1eadp <\/span><span style=\"font-weight: 400;\">nodes.roles<\/span><span style=\"font-weight: 400;\">, theo m\u1eb7c \u0111\u1ecbnh, c\u00e1c node s\u1ebd \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh c\u00e1c vai tr\u00f2 sau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Master-eligible node:<\/b><span style=\"font-weight: 400;\"> C\u00e1c node n\u00e0y ch\u1ecbu tr\u00e1ch nhi\u1ec7m cho c\u00e1c h\u00e0nh \u0111\u1ed9ng tr\u00ean to\u00e0n cluster nh\u01b0 t\u1ea1o ho\u1eb7c x\u00f3a index, qu\u1ea3n l\u00fd c\u00e1c node v\u00e0 duy tr\u00ec t\u00ecnh tr\u1ea1ng chung c\u1ee7a cluster. Ch\u00fang tham gia v\u00e0o qu\u00e1 tr\u00ecnh b\u1ea7u ch\u1ecdn cho m\u1ed9t node ch\u1ee7 v\u00e0 m\u1ed9t trong s\u1ed1 ch\u00fang \u0111\u01b0\u1ee3c b\u1ea7u l\u00e0m node ch\u1ee7.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Data node:<\/b><span style=\"font-weight: 400;\"> Data node l\u01b0u tr\u1eef d\u1eef li\u1ec7u th\u1ef1c t\u1ebf, \u0111\u01b0\u1ee3c g\u1ecdi l\u00e0 shard. Ch\u00fang th\u1ef1c hi\u1ec7n c\u00e1c ho\u1ea1t \u0111\u1ed9ng li\u00ean quan \u0111\u1ebfn d\u1eef li\u1ec7u nh\u01b0 l\u1eadp index, t\u00ecm ki\u1ebfm v\u00e0 t\u1ed5ng h\u1ee3p. Ch\u00fang c\u0169ng qu\u1ea3n l\u00fd vi\u1ec7c sao ch\u00e9p d\u1eef li\u1ec7u \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o t\u00ednh kh\u1ea3 d\u1ee5ng v\u00e0 kh\u1ea3 n\u0103ng ph\u1ee5c h\u1ed3i cao.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ingest node:<\/b><span style=\"font-weight: 400;\"> C\u00e1c node n\u00e0y x\u1eed l\u00fd tr\u01b0\u1edbc d\u1eef li\u1ec7u \u0111\u1ebfn tr\u01b0\u1edbc khi l\u1eadp index. Ch\u00fang s\u1eed d\u1ee5ng c\u00e1c ingest pipeline c\u1ee7a Elasticsearch \u0111\u1ec3 chuy\u1ec3n \u0111\u1ed5i, l\u00e0m gi\u00e0u v\u00e0 l\u1ecdc d\u1eef li\u1ec7u khi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c thu th\u1eadp.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Coordinating (client) node:<\/b><span style=\"font-weight: 400;\"> C\u00e1c node n\u00e0y \u0111\u1ecbnh tuy\u1ebfn y\u00eau c\u1ea7u t\u00ecm ki\u1ebfm v\u00e0 x\u1eed l\u00fd k\u1ebft qu\u1ea3 truy v\u1ea5n. Ch\u00fang kh\u00f4ng l\u01b0u tr\u1eef d\u1eef li\u1ec7u ho\u1eb7c th\u1ef1c hi\u1ec7n x\u1eed l\u00fd nh\u1eadp d\u1eef li\u1ec7u m\u00e0 ho\u1ea1t \u0111\u1ed9ng nh\u01b0 b\u1ed9 c\u00e2n b\u1eb1ng t\u1ea3i th\u00f4ng minh gi\u00fap t\u1ed1i \u01b0u h\u00f3a vi\u1ec7c ph\u00e2n ph\u1ed1i c\u00e1c truy v\u1ea5n v\u00e0 t\u1ed5ng h\u1ee3p.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Machine learning node:<\/b><span style=\"font-weight: 400;\"> Node chuy\u00ean ch\u1ea1y t\u00e1c v\u1ee5 h\u1ecdc m\u00e1y trong Elasticsearch, th\u01b0\u1eddng \u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 ph\u00e1t hi\u1ec7n b\u1ea5t th\u01b0\u1eddng v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Cross-cluster search (CCS) node: <\/b><span style=\"font-weight: 400;\">C\u00e1c CCS node cho ph\u00e9p truy v\u1ea5n nhi\u1ec1u Elasticsearch cluster c\u00f9ng l\u00fac, ho\u1ea1t \u0111\u1ed9ng nh\u01b0 m\u1ed9t \u0111i\u1ec3m duy nh\u1ea5t \u0111\u1ec3 th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm li\u00ean k\u1ebft tr\u00ean c\u00e1c cluster n\u00e0y.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Voting-only node:<\/b><span style=\"font-weight: 400;\"> C\u00e1c node n\u00e0y \u0111\u1ee7 \u0111i\u1ec1u ki\u1ec7n l\u00e0m node ch\u00ednh nh\u01b0ng kh\u00f4ng th\u1ec3 tr\u1edf th\u00e0nh node ch\u00ednh. Ch\u1ee9c n\u0103ng ch\u00ednh c\u1ee7a ch\u00fang l\u00e0 \u201cb\u1ecf phi\u1ebfu\u201d trong \u201ccu\u1ed9c b\u1ea7u ch\u1ecdn\u201d node ch\u00ednh, gi\u00fap ng\u0103n ng\u1eeba t\u00ecnh tr\u1ea1ng b\u1ecf phi\u1ebfu h\u00f2a v\u00e0 duy tr\u00ec t\u00ednh \u1ed5n \u0111\u1ecbnh c\u1ee7a cluster.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Khi thi\u1ebft l\u1eadp <\/span><span style=\"font-weight: 400;\">nodes.roles<\/span><span style=\"font-weight: 400;\">, h\u00e3y ki\u1ec3m tra ch\u00e9o xem c\u00e1c node \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh vai tr\u00f2 theo nhu c\u1ea7u c\u1ee7a cluster ch\u01b0a. V\u00ed d\u1ee5, vai tr\u00f2 master v\u00e0 data l\u00e0 b\u1eaft bu\u1ed9c \u0111\u1ed1i v\u1edbi m\u1ecdi cluster.<\/span><\/p>\n<h3><b>C\u00e1c t\u00ednh n\u0103ng ch\u00ednh c\u1ee7a Query DSL c\u1ee7a Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00e1c t\u00ednh n\u0103ng ch\u00ednh c\u1ee7a Query DSL c\u1ee7a Elasticsearch bao g\u1ed3m kh\u1ea3 n\u0103ng t\u00ecm ki\u1ebfm, ch\u1eb3ng h\u1ea1n nh\u01b0 truy v\u1ea5n to\u00e0n v\u0103n, truy v\u1ea5n c\u00f3 c\u1ea5u tr\u00fac v\u00e0 c\u1ea5u tr\u00fac truy v\u1ea5n ph\u1ee9c t\u1ea1p. T\u00ednh linh ho\u1ea1t n\u00e0y cho ph\u00e9p truy xu\u1ea5t d\u1eef li\u1ec7u ch\u00ednh x\u00e1c v\u00e0 hi\u1ec7u qu\u1ea3.<\/span><\/p>\n<h3><b>Fuzzy search trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">V\u1edbi fuzzy search, b\u1ea1n c\u00f3 th\u1ec3 t\u00ecm c\u00e1c t\u00e0i li\u1ec7u c\u00f3 thu\u1eadt ng\u1eef t\u01b0\u01a1ng t\u1ef1 v\u1edbi thu\u1eadt ng\u1eef t\u00ecm ki\u1ebfm c\u1ee7a m\u00ecnh d\u1ef1a tr\u00ean ph\u00e9p \u0111o kho\u1ea3ng c\u00e1ch ch\u1ec9nh s\u1eeda Levenshtein. Kho\u1ea3ng c\u00e1ch ch\u1ec9nh s\u1eeda v\u1ec1 c\u01a1 b\u1ea3n l\u00e0 s\u1ed1 l\u1ea7n thay \u0111\u1ed5i ho\u1eb7c ch\u1ec9nh s\u1eeda m\u1ed9t k\u00fd t\u1ef1 \u0111\u01a1n c\u1ea7n thi\u1ebft \u0111\u1ec3 thay \u0111\u1ed5i m\u1ed9t thu\u1eadt ng\u1eef th\u00e0nh m\u1ed9t thu\u1eadt ng\u1eef kh\u00e1c. Nh\u1eefng thay \u0111\u1ed5i n\u00e0y c\u00f3 th\u1ec3 k\u1ec3 \u0111\u1ebfn:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Thay \u0111\u1ed5i m\u1ed9t k\u00fd t\u1ef1 (box \u2192 fox)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">X\u00f3a m\u1ed9t k\u00fd t\u1ef1 (black \u2192 lack)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ch\u00e8n m\u1ed9t k\u00fd t\u1ef1 (sic \u2192 sick)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Chuy\u1ec3n v\u1ecb tr\u00ed hai k\u00fd t\u1ef1 li\u1ec1n k\u1ec1 (act \u2192 cat)<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Trong ph\u1ea1m vi ch\u1ec9nh s\u1eeda c\u1ee5 th\u1ec3, fuzzy search t\u1ea1o ra danh s\u00e1ch t\u1ea5t c\u1ea3 c\u00e1c bi\u1ebfn th\u1ec3 v\u00e0 m\u1edf r\u1ed9ng c\u00f3 th\u1ec3 c\u00f3 c\u1ee7a thu\u1eadt ng\u1eef t\u00ecm ki\u1ebfm. Sau \u0111\u00f3, truy v\u1ea5n tr\u1ea3 v\u1ec1 danh s\u00e1ch t\u1ea5t c\u1ea3 c\u00e1c k\u1ebft qu\u1ea3 kh\u1edbp. C\u00e1c k\u1ebft qu\u1ea3 kh\u1edbp ch\u00ednh x\u00e1c v\u00e0 c\u00f3 li\u00ean quan nh\u1ea5t s\u1ebd xu\u1ea5t hi\u1ec7n g\u1ea7n \u0111\u1ea7u danh s\u00e1ch.<\/span><\/p>\n<h3><b>Li\u1ec7t k\u00ea c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u ElasticSearch kh\u00e1c nhau cho c\u00e1c tr\u01b0\u1eddng t\u00e0i li\u1ec7u<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3u tr\u01b0\u1eddng (c\u00f2n g\u1ecdi l\u00e0 ki\u1ec3u d\u1eef li\u1ec7u tr\u01b0\u1eddng) m\u00f4 t\u1ea3 lo\u1ea1i th\u00f4ng tin ho\u1eb7c d\u1eef li\u1ec7u m\u00e0 m\u1ed9t tr\u01b0\u1eddng ch\u1ee9a, ch\u1eb3ng h\u1ea1n nh\u01b0 string ho\u1eb7c boolean v\u00e0 m\u1ee5c \u0111\u00edch s\u1eed d\u1ee5ng d\u1ef1 ki\u1ebfn \u200b\u200bc\u1ee7a n\u00f3. Sau \u0111\u00e2y l\u00e0 m\u1ed9t s\u1ed1 ki\u1ec3u d\u1eef li\u1ec7u cho tr\u01b0\u1eddng t\u00e0i li\u1ec7u:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">C\u00e1c ki\u1ec3u d\u1eef li\u1ec7u ph\u1ed5 bi\u1ebfn:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Binary: Gi\u00e1 tr\u1ecb nh\u1ecb ph\u00e2n \u0111\u01b0\u1ee3c m\u00e3 h\u00f3a d\u01b0\u1edbi d\u1ea1ng chu\u1ed7i Base64.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Boolean: Gi\u00e1 tr\u1ecb \u0111\u00fang ho\u1eb7c sai.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Keyword: T\u1eeb kh\u00f3a, t\u1eeb kh\u00f3a h\u1eb1ng v\u00e0 k\u00fd t\u1ef1 \u0111\u1ea1i di\u1ec7n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Number: C\u00e1c ki\u1ec3u s\u1ed1 nh\u01b0 long, double, float, byte, integer, v.v.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Date: Ki\u1ec3u ng\u00e0y, ch\u1eb3ng h\u1ea1n nh\u01b0 date_nano, date.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Alias: Bi\u1ec3u th\u1ecb bi\u1ec7t danh c\u1ee7a m\u1ed9t tr\u01b0\u1eddng hi\u1ec7n c\u00f3.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">\u0110\u1ed1i t\u01b0\u1ee3ng v\u00e0 ki\u1ec3u quan h\u1ec7:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Object: Bi\u1ec3u di\u1ec5n m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Nested: M\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng JSON duy tr\u00ec m\u1ed1i quan h\u1ec7 gi\u1eefa c\u00e1c tr\u01b0\u1eddng con c\u1ee7a n\u00f3.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Flattened: To\u00e0n b\u1ed9 \u0111\u1ed1i t\u01b0\u1ee3ng JSON \u0111\u01b0\u1ee3c bi\u1ec3u di\u1ec5n b\u1eb1ng m\u1ed9t gi\u00e1 tr\u1ecb tr\u01b0\u1eddng duy nh\u1ea5t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Join: Thi\u1ebft l\u1eadp m\u1ed1i quan h\u1ec7 cha\/con gi\u1eefa c\u00e1c t\u00e0i li\u1ec7u trong m\u1ed9t index.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3u d\u1eef li\u1ec7u c\u00f3 c\u1ea5u tr\u00fac v\u00e0 kh\u00f4ng gian:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Range: C\u00e1c ki\u1ec3u ph\u1ea1m vi, nh\u01b0 date_range, long_range, float_range, double_range v\u00e0 IP_range.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Point: \u0110i\u1ec3m Descartes t\u00f9y \u00fd.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Geo_point: \u0110i\u1ec3m kinh \u0111\u1ed9 v\u00e0 v\u0129 \u0111\u1ed9<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Shape: H\u00ecnh h\u1ecdc Descartes t\u00f9y \u00fd.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Geo_shape: H\u00ecnh d\u1ea1ng ph\u1ee9c t\u1ea1p nh\u01b0 \u0111a gi\u00e1c<\/span><\/li>\n<\/ul>\n<h3><b>Analyzer trong Elasticsearch l\u00e0 g\u00ec v\u00e0 ch\u00fang \u0111\u00f3ng vai tr\u00f2 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Elasticsearch, m\u1ed9t analyzer l\u00e0 m\u1ed9t th\u00e0nh ph\u1ea7n \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 m\u00e3 h\u00f3a v\u0103n b\u1ea3n. Tr\u00ecnh ph\u00e2n t\u00edch analyzer \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 chia nh\u1ecf v\u0103n b\u1ea3n th\u00e0nh c\u00e1c \u0111\u01a1n v\u1ecb nh\u1ecf h\u01a1n g\u1ecdi l\u00e0 m\u00e3 th\u00f4ng b\u00e1o. C\u00e1c m\u00e3 th\u00f4ng b\u00e1o n\u00e0y sau \u0111\u00f3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm v\u0103n b\u1ea3n. M\u1ee5c ti\u00eau ch\u00ednh c\u1ee7a analyzer l\u00e0 chuy\u1ec3n \u0111\u1ed5i v\u0103n b\u1ea3n th\u00f4 th\u00e0nh \u0111\u1ecbnh d\u1ea1ng c\u00f3 c\u1ea5u tr\u00fac (m\u00e3 th\u00f4ng b\u00e1o) c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c t\u00ecm ki\u1ebfm v\u00e0 ph\u00e2n t\u00edch hi\u1ec7u qu\u1ea3.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed9t analyzer bao g\u1ed3m ba th\u00e0nh ph\u1ea7n ch\u00ednh:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Tokenizer:<\/b><span style=\"font-weight: 400;\"> C\u00f4ng c\u1ee5 chia nh\u1ecf v\u0103n b\u1ea3n \u0111\u1ea7u v\u00e0o th\u00e0nh m\u1ed9t chu\u1ed7i c\u00e1c thu\u1eadt ng\u1eef (token), th\u01b0\u1eddng b\u1eb1ng c\u00e1ch ph\u00e2n t\u00e1ch v\u0103n b\u1ea3n theo kho\u1ea3ng tr\u1eafng ho\u1eb7c ranh gi\u1edbi d\u1ea5u c\u00e2u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Token filter:<\/b><span style=\"font-weight: 400;\"> B\u1ed9 l\u1ecdc token x\u1eed l\u00fd lu\u1ed3ng m\u00e3 th\u00f4ng b\u00e1o do tr\u00ecnh t\u1ea1o m\u00e3 th\u00f4ng b\u00e1o t\u1ea1o ra v\u00e0 c\u00f3 th\u1ec3 s\u1eeda \u0111\u1ed5i, th\u00eam ho\u1eb7c x\u00f3a m\u00e3 th\u00f4ng b\u00e1o.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Character filter: <\/b><span style=\"font-weight: 400;\">B\u1ed9 l\u1ecdc k\u00fd t\u1ef1 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u1eed l\u00fd v\u0103n b\u1ea3n \u0111\u1ea7u v\u00e0o tr\u01b0\u1edbc khi \u0111\u1ebfn tokenizer. Ch\u00fang c\u00f3 th\u1ec3 s\u1eeda \u0111\u1ed5i, th\u00eam ho\u1eb7c x\u00f3a t\u1eebng k\u00fd t\u1ef1 kh\u1ecfi v\u0103n b\u1ea3n.<\/span><\/li>\n<\/ul>\n<h3><b>&#8216;Type&#8217; trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Type trong Elasticsearch l\u00e0 m\u1ed9t kh\u00e1i ni\u1ec7m \u0111\u00e3 b\u1ecb lo\u1ea1i b\u1ecf t\u1eeb phi\u00ean b\u1ea3n 7.0 tr\u1edf \u0111i. Tr\u01b0\u1edbc \u0111\u00e2y, type \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nh\u01b0 c\u00e1c danh m\u1ee5c logic ho\u1eb7c c\u00e1c ph\u1ea7n c\u1ee7a m\u1ed9t index, t\u01b0\u01a1ng t\u1ef1 nh\u01b0 table trong c\u01a1 s\u1edf d\u1eef li\u1ec7u quan h\u1ec7. Tuy nhi\u00ean, do h\u1ea1n ch\u1ebf k\u1ef9 thu\u1eadt v\u00e0 \u0111\u1ec3 \u0111\u01a1n gi\u1ea3n h\u00f3a m\u00f4 h\u00ecnh d\u1eef li\u1ec7u, Elasticsearch \u0111\u00e3 chuy\u1ec3n sang m\u00f4 h\u00ecnh &#8216;m\u1ed9t index, m\u1ed9t type&#8217;. \u1ee8ng d\u1ee5ng m\u1edbi n\u00ean s\u1eed d\u1ee5ng m\u1ed9t index ri\u00eang bi\u1ec7t cho m\u1ed7i lo\u1ea1i d\u1eef li\u1ec7u thay v\u00ec s\u1eed d\u1ee5ng nhi\u1ec1u type trong m\u1ed9t index.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Trong k\u1ecbch b\u1ea3n s\u1ea3n xu\u1ea5t \u00f4 t\u00f4 c\u1ee7a b\u1ea1n, b\u1ea1n c\u00f3 m\u1ed9t Tatafactory index. C\u00f3 ba type (table) trong index n\u00e0y nh\u01b0 sau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Cars<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">People<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Spare_Parts<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">M\u1ed7i type sau \u0111\u00f3 ch\u1ee9a c\u00e1c t\u00e0i li\u1ec7u c\u00f3 li\u00ean quan \u0111\u1ebfn type \u0111\u00f3 (v\u00ed d\u1ee5: t\u00e0i li\u1ec7u Tata Innova \u0111\u01b0\u1ee3c l\u01b0u trong type Cars). Trong t\u00e0i li\u1ec7u n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 t\u00ecm th\u1ea5y t\u1ea5t c\u1ea3 th\u00f4ng tin v\u1ec1 chi\u1ebfc xe c\u1ee5 th\u1ec3.<\/span><\/p>\n<h3><b>Elasticsearch \u0111\u1ea3m b\u1ea3o \u0111\u1ed9 tin c\u1eady d\u1eef li\u1ec7u nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch \u0111\u1ea3m b\u1ea3o \u0111\u1ed9 b\u1ec1n d\u1eef li\u1ec7u b\u1eb1ng c\u00e1ch sao ch\u00e9p d\u1eef li\u1ec7u tr\u00ean c\u00e1c node kh\u00e1c nhau v\u00e0 ghi c\u00e1c ho\u1ea1t \u0111\u1ed9ng v\u00e0o nh\u1eadt k\u00fd giao d\u1ecbch. Ph\u01b0\u01a1ng ph\u00e1p n\u00e0y cung c\u1ea5p kh\u1ea3 n\u0103ng ph\u1ee5c h\u1ed3i, ph\u00f2ng ch\u1ed1ng m\u1ea5t d\u1eef li\u1ec7u v\u00e0 duy tr\u00ec t\u00ednh to\u00e0n v\u1eb9n c\u1ee7a d\u1eef li\u1ec7u.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Elasticsearch s\u1eed d\u1ee5ng c\u01a1 ch\u1ebf ghi v\u00e0o nh\u1eadt k\u00fd giao d\u1ecbch (transaction log) tr\u01b0\u1edbc khi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c ghi v\u00e0o \u0111\u0129a, gi\u00fap kh\u00f4i ph\u1ee5c khi x\u1ea3y ra s\u1ef1 c\u1ed1. Ngo\u00e0i ra, t\u00ednh n\u0103ng replica shards l\u00e0 c\u01a1 ch\u1ebf ch\u00ednh \u0111\u1ea3m b\u1ea3o t\u00ednh s\u1eb5n s\u00e0ng cao &#8211; n\u1ebfu m\u1ed9t node ch\u1ee9a primary shard b\u1ecb l\u1ed7i, replica shard s\u1ebd \u0111\u01b0\u1ee3c th\u0103ng c\u1ea5p th\u00e0nh primary shard m\u1edbi. Elasticsearch c\u0169ng h\u1ed7 tr\u1ee3 c\u1ea5u h\u00ecnh wait_for_active_shards \u0111\u1ec3 ki\u1ec3m so\u00e1t s\u1ed1 l\u01b0\u1ee3ng b\u1ea3n sao c\u1ea7n thi\u1ebft tr\u01b0\u1edbc khi ho\u00e0n th\u00e0nh ghi.<\/span><\/p>\n<h3><b>T\u1ea7m quan tr\u1ecdng c\u1ee7a tr\u01b0\u1eddng<\/b><b> _source<\/b><b> trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1eddng <\/span><span style=\"font-weight: 400;\">_source<\/span><span style=\"font-weight: 400;\"> trong Elasticsearch l\u00e0 m\u1ed9t tr\u01b0\u1eddng h\u1ec7 th\u1ed1ng quan tr\u1ecdng l\u01b0u tr\u1eef \u0111\u1ed1i t\u01b0\u1ee3ng JSON g\u1ed1c \u0111\u01b0\u1ee3c truy\u1ec1n khi m\u1ed9t t\u00e0i li\u1ec7u \u0111\u01b0\u1ee3c l\u1eadp index. \u0110\u00e2y l\u00e0 m\u1ed9t ph\u1ea7n thi\u1ebft y\u1ebfu c\u1ee7a Elasticsearch v\u00ec ch\u00fang cho ph\u00e9p nhi\u1ec1u ch\u1ee9c n\u0103ng kh\u00e1c nhau v\u00e0 cung c\u1ea5p m\u1ed9t s\u1ed1 l\u1ee3i \u00edch nh\u01b0:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Truy xu\u1ea5t t\u00e0i li\u1ec7u: Khi b\u1ea1n truy xu\u1ea5t t\u00e0i li\u1ec7u ho\u1eb7c th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm trong Elasticsearch, tr\u01b0\u1eddng <\/span><span style=\"font-weight: 400;\">_source<\/span><span style=\"font-weight: 400;\"> cho ph\u00e9p b\u1ea1n tr\u1ea3 v\u1ec1 to\u00e0n b\u1ed9 ho\u1eb7c m\u1ed9t ph\u1ea7n \u0111\u1ed1i t\u01b0\u1ee3ng JSON g\u1ed1c cho ng\u01b0\u1eddi d\u00f9ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u1eadp nh\u1eadt m\u1ed9t ph\u1ea7n: Elasticsearch h\u1ed7 tr\u1ee3 c\u1eadp nh\u1eadt m\u1ed9t ph\u1ea7n, cho ph\u00e9p b\u1ea1n s\u1eeda \u0111\u1ed5i c\u00e1c tr\u01b0\u1eddng c\u1ee5 th\u1ec3 trong t\u00e0i li\u1ec7u m\u00e0 kh\u00f4ng c\u1ea7n l\u1eadp index to\u00e0n b\u1ed9 t\u00e0i li\u1ec7u. B\u1eb1ng c\u00e1ch ch\u1ec9 \u0111\u1ecbnh tr\u01b0\u1eddng<\/span><span style=\"font-weight: 400;\"> _source <\/span><span style=\"font-weight: 400;\">trong y\u00eau c\u1ea7u c\u1eadp nh\u1eadt v\u00e0 cung c\u1ea5p c\u00e1c tr\u01b0\u1eddng \u0111\u00e3 c\u1eadp nh\u1eadt, b\u1ea1n c\u00f3 th\u1ec3 c\u1eadp nh\u1eadt c\u00e1c ph\u1ea7n c\u1ea7n thi\u1ebft c\u1ee7a t\u00e0i li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u1ecdc ngu\u1ed3n: Elasticsearch cung c\u1ea5p t\u00ednh n\u0103ng l\u1ecdc ngu\u1ed3n, cho ph\u00e9p ki\u1ec3m so\u00e1t c\u00e1c tr\u01b0\u1eddng \u0111\u01b0\u1ee3c tr\u1ea3 v\u1ec1 trong k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm. V\u1edbi t\u00ednh n\u0103ng l\u1ecdc ngu\u1ed3n, b\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh danh s\u00e1ch tr\u1eafng ho\u1eb7c danh s\u00e1ch \u0111en c\u00e1c tr\u01b0\u1eddng \u0111\u1ec3 bao g\u1ed3m ho\u1eb7c lo\u1ea1i tr\u1eeb kh\u1ecfi tr\u01b0\u1eddng <\/span><span style=\"font-weight: 400;\">_source<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\n<h3><b>Gi\u1ea3i th\u00edch ch\u1ee9c n\u0103ng c\u1ee7a cat.indices trong Elasticsearch<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Elasticsearch, API cat.indices cung c\u1ea5p c\u00e1ch l\u1ea5y th\u00f4ng tin v\u1ec1 c\u00e1c index trong cluster theo \u0111\u1ecbnh d\u1ea1ng m\u00e0 con ng\u01b0\u1eddi c\u00f3 th\u1ec3 \u0111\u1ecdc. API cat.indices cho ph\u00e9p b\u1ea1n l\u1ea5y nhi\u1ec1u th\u00f4ng tin chi ti\u1ebft v\u00e0 s\u1ed1 li\u1ec7u th\u1ed1ng k\u00ea kh\u00e1c nhau v\u1ec1 c\u00e1c index, ch\u1eb3ng h\u1ea1n nh\u01b0 t\u00ean, k\u00edch th\u01b0\u1edbc, tr\u1ea1ng th\u00e1i, s\u1ed1 l\u01b0\u1ee3ng t\u00e0i li\u1ec7u&#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">API cat.indices ch\u1ee7 y\u1ebfu \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho m\u1ee5c \u0111\u00edch gi\u00e1m s\u00e1t v\u00e0 kh\u1eafc ph\u1ee5c s\u1ef1 c\u1ed1 nh\u1edd cung c\u1ea5p t\u1ed5ng quan nhanh ch\u00f3ng v\u00e0 ng\u1eafn g\u1ecdn v\u1ec1 c\u00e1c index trong Elasticsearch cluster. N\u00f3 th\u01b0\u1eddng \u0111\u01b0\u1ee3c qu\u1ea3n tr\u1ecb vi\u00ean v\u00e0 developer s\u1eed d\u1ee5ng \u0111\u1ec3 thu th\u1eadp th\u00f4ng tin c\u1ea7n thi\u1ebft v\u1ec1 tr\u1ea1ng th\u00e1i v\u00e0 hi\u1ec7u su\u1ea5t c\u1ee7a c\u00e1c index.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_phong_van_Elasticsearch_cap_trung\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p trung<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b> X\u1eed l\u00fd sao l\u01b0u v\u00e0 ph\u1ee5c h\u1ed3i d\u1eef li\u1ec7u trong Elasticsearch nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Sao l\u01b0u v\u00e0 ph\u1ee5c h\u1ed3i d\u1eef li\u1ec7u trong Elasticsearch \u0111\u01b0\u1ee3c x\u1eed l\u00fd th\u00f4ng qua ch\u1ee9c n\u0103ng snapshot v\u00e0 restore. Snapshot l\u00e0 gia t\u0103ng v\u00e0 c\u00f3 th\u1ec3 n\u1eafm b\u1eaft tr\u1ea1ng th\u00e1i c\u1ee7a to\u00e0n b\u1ed9 cluster ho\u1eb7c c\u00e1c index c\u1ee5 th\u1ec3. \u0110i\u1ec1u n\u00e0y \u0111\u1ea3m b\u1ea3o d\u1eef li\u1ec7u c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c ph\u1ee5c h\u1ed3i trong tr\u01b0\u1eddng h\u1ee3p h\u1ec7 th\u1ed1ng b\u1ecb l\u1ed7i.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 sao l\u01b0u Elasticsearch, \u0111\u1ea7u ti\u00ean b\u1ea1n c\u1ea7n \u0111\u0103ng k\u00fd repository l\u01b0u tr\u1eef snapshot (c\u00f3 th\u1ec3 l\u00e0 h\u1ec7 th\u1ed1ng t\u1ec7p c\u1ee5c b\u1ed9, S3, Google Cloud Storage, v.v.). Sau \u0111\u00f3, b\u1ea1n c\u00f3 th\u1ec3 t\u1ea1o snapshot b\u1eb1ng API:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/_snapshot\/my_backup\/snapshot_1<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 kh\u00f4i ph\u1ee5c, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng API restore:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">POST \/_snapshot\/my_backup\/snapshot_1\/_restore<\/span><\/pre>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 tri\u1ec3n khai b\u1ea3o m\u1eadt trong c\u00e1c Elasticsearch cluster?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c tri\u1ec3n khai b\u1ea3o m\u1eadt trong c\u00e1c Elasticsearch cluster bao g\u1ed3m c\u1ea5u h\u00ecnh ki\u1ec3m so\u00e1t truy c\u1eadp d\u1ef1a tr\u00ean vai tr\u00f2, HTTPS \u0111\u1ec3 li\u00ean l\u1ea1c \u0111\u01b0\u1ee3c m\u00e3 h\u00f3a, l\u1ecdc IP v\u00e0 ghi nh\u1eadt k\u00fd ki\u1ec3m tra. C\u00e1c bi\u1ec7n ph\u00e1p b\u1ea3o m\u1eadt b\u1ea3o v\u1ec7 d\u1eef li\u1ec7u v\u00e0 \u0111\u1ea3m b\u1ea3o tu\u00e2n th\u1ee7 c\u00e1c y\u00eau c\u1ea7u theo quy \u0111\u1ecbnh.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">B\u1ea3o m\u1eadt Elasticsearch bao g\u1ed3m nhi\u1ec1u l\u1edbp:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">TLS\/SSL cho m\u00e3 h\u00f3a d\u1eef li\u1ec7u tr\u00ean \u0111\u01b0\u1eddng truy\u1ec1n;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">X\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng th\u00f4ng qua m\u1eadt kh\u1ea9u, LDAP, Active Directory ho\u1eb7c SSO;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ki\u1ec3m so\u00e1t truy c\u1eadp d\u1ef1a tr\u00ean vai tr\u00f2 (RBAC) \u0111\u1ec3 ph\u00e2n quy\u1ec1n chi ti\u1ebft;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">M\u00e3 h\u00f3a d\u1eef li\u1ec7u t\u0129nh (encryption-at-rest) \u0111\u1ec3 b\u1ea3o v\u1ec7 d\u1eef li\u1ec7u tr\u00ean \u0111\u0129a;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ki\u1ec3m to\u00e1n b\u1ea3o m\u1eadt \u0111\u1ec3 theo d\u00f5i c\u00e1c h\u00e0nh \u0111\u1ed9ng ng\u01b0\u1eddi d\u00f9ng;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u1ecdc IP \u0111\u1ec3 gi\u1edbi h\u1ea1n quy\u1ec1n truy c\u1eadp v\u00e0o cluster theo \u0111\u1ecba ch\u1ec9 IP.<\/span><\/li>\n<\/ul>\n<h3><b> Gi\u1ea3i th\u00edch vi\u1ec7c s\u1eed d\u1ee5ng h\u00e0m <\/b><b>script_score<\/b><b> c\u1ee7a Elasticsearch<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">H\u00e0m <\/span><span style=\"font-weight: 400;\">script_score<\/span><span style=\"font-weight: 400;\"> trong Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng linh ho\u1ea1t \u0111\u1ec3 t\u00f9y ch\u1ec9nh \u0111i\u1ec3m s\u1ed1 c\u1ee7a k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm d\u1ef1a tr\u00ean m\u1ed9t t\u1eadp l\u1ec7nh ch\u1ea5m \u0111i\u1ec3m t\u00f9y ch\u1ec9nh. H\u00e0m n\u00e0y cho ph\u00e9p b\u1ea1n t\u00e1c \u0111\u1ed9ng \u0111\u1ebfn \u0111i\u1ec3m s\u1ed1 li\u00ean quan c\u1ee7a c\u00e1c t\u00e0i li\u1ec7u b\u1eb1ng c\u00e1ch cung c\u1ea5p m\u1ed9t t\u1eadp l\u1ec7nh t\u00ednh \u0111i\u1ec3m t\u00f9y ch\u1ec9nh cho t\u1eebng t\u00e0i li\u1ec7u.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5 v\u1ec1 vi\u1ec7c s\u1eed d\u1ee5ng script_score \u0111\u1ec3 \u0111i\u1ec1u ch\u1ec9nh \u0111i\u1ec3m d\u1ef1a tr\u00ean kho\u1ea3ng c\u00e1ch \u0111\u1ecba l\u00fd:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"function_score\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"query\": { \"match_all\": {} },<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"script_score\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"script\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"source\": \"decayDateGauss(doc['date'].value, '2021-01-01', '30d')\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>Nh\u1eefng bi\u1ec7n ph\u00e1p t\u1ed1t nh\u1ea5t \u0111\u1ec3 qu\u1ea3n l\u00fd nh\u1eadt k\u00fd Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Qu\u1ea3n l\u00fd nh\u1eadt k\u00fd hi\u1ec7u qu\u1ea3 trong Elasticsearch r\u1ea5t quan tr\u1ecdng \u0111\u1ec3 gi\u00e1m s\u00e1t, kh\u1eafc ph\u1ee5c s\u1ef1 c\u1ed1 v\u00e0 v\u1eadn h\u00e0nh tr\u01a1n tru c\u00e1c Elasticsearch cluster. C\u00e1c bi\u1ec7n ph\u00e1p th\u1ef1c h\u00e0nh t\u1ed1t nh\u1ea5t \u0111\u1ec3 qu\u1ea3n l\u00fd nh\u1eadt k\u00fd Elasticsearch bao g\u1ed3m thi\u1ebft l\u1eadp m\u1ee9c nh\u1eadt k\u00fd ph\u00f9 h\u1ee3p, ghi nh\u1eadt k\u00fd c\u00f3 c\u1ea5u tr\u00fac v\u00e0 t\u00edch h\u1ee3p c\u00e1c h\u1ec7 th\u1ed1ng qu\u1ea3n l\u00fd nh\u1eadt k\u00fd.\u00a0<\/span><\/p>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 s\u1eed d\u1ee5ng Profile API trong Elasticsearch \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a truy v\u1ea5n?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Profile API trong Elasticsearch cung c\u1ea5p th\u00f4ng tin chi ti\u1ebft v\u1ec1 vi\u1ec7c th\u1ef1c hi\u1ec7n truy v\u1ea5n. Profile API r\u1ea5t quan tr\u1ecdng \u0111\u1ec3 hi\u1ec3u hi\u1ec7u su\u1ea5t truy v\u1ea5n v\u00e0 x\u00e1c \u0111\u1ecbnh c\u00e1c \u0111i\u1ec3m ngh\u1ebdn trong Elasticsearch.<\/span><\/p>\n<h3><b>Vai tr\u00f2 c\u1ee7a Elasticsearch Ingest Node l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch Ingest Node x\u1eed l\u00fd tr\u01b0\u1edbc c\u00e1c t\u00e0i li\u1ec7u tr\u01b0\u1edbc khi l\u1eadp index, cho ph\u00e9p chuy\u1ec3n \u0111\u1ed5i v\u00e0 l\u00e0m gi\u00e0u d\u1eef li\u1ec7u. Ingest Node r\u1ea5t c\u1ea7n thi\u1ebft \u0111\u1ec3 chu\u1ea9n b\u1ecb d\u1eef li\u1ec7u v\u00e0 \u0111\u1ea3m b\u1ea3o c\u00e1c y\u00eau c\u1ea7u l\u1eadp index c\u1ee7a Elasticsearch.<\/span><\/p>\n<h3><b>Ch\u1ec9 ra \u0111i\u1ec3m kh\u00e1c bi\u1ec7t gi\u1eefa query v\u00e0 filter?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Filter trong Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho c\u00e1c truy v\u1ea5n kh\u00f4ng t\u00ednh \u0111i\u1ec3m, \u0111\u01b0\u1ee3c l\u01b0u trong b\u1ed9 nh\u1edb \u0111\u1ec7m g\u00f3p ph\u1ea7n n\u00e2ng cao hi\u1ec7u qu\u1ea3 truy v\u1ea5n. C\u00e1c query \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho t\u00ecm ki\u1ebfm to\u00e0n v\u0103n b\u1ea3n v\u1edbi \u0111i\u1ec3m li\u00ean quan. S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa filter v\u00e0 query r\u1ea5t quan tr\u1ecdng \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a hi\u1ec7u su\u1ea5t t\u00ecm ki\u1ebfm.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Query v\u00e0 filter c\u00f3 nh\u1eefng kh\u00e1c bi\u1ec7t quan tr\u1ecdng nh\u01b0:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>\u0110\u1eb7c \u0111i\u1ec3m<\/b><\/td>\n<td><b>Query<\/b><\/td>\n<td><b>Filter<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">T\u00ednh \u0111i\u1ec3m<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Query t\u00ednh \u0111i\u1ec3m li\u00ean quan.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Filter kh\u00f4ng t\u00ednh \u0111i\u1ec3m.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">B\u1ed9 nh\u1edb \u0111\u1ec7m<\/span><\/td>\n<td><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 query kh\u00f4ng \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o b\u1ed9 nh\u1edb \u0111\u1ec7m.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 filter \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o b\u1ed9 nh\u1edb \u0111\u1ec7m.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Hi\u1ec7u su\u1ea5t<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hi\u1ec7u su\u1ea5t c\u1ee7a query ch\u1eadm h\u01a1n.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Filter th\u01b0\u1eddng nhanh h\u01a1n v\u00ec kh\u00f4ng t\u00ednh \u0111i\u1ec3m v\u00e0 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng b\u1ed9 nh\u1edb \u0111\u1ec7m<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">M\u1ee5c \u0111\u00edch s\u1eed d\u1ee5ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Query d\u00f9ng cho t\u00ecm ki\u1ebfm v\u1edbi \u0111\u1ed9 li\u00ean quan cao (v\u00ed d\u1ee5: &#8216;t\u00ecm t\u00e0i li\u1ec7u gi\u1ed1ng v\u1edbi X&#8217;).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Filter d\u00f9ng cho truy v\u1ea5n ch\u00ednh x\u00e1c (v\u00ed d\u1ee5: &#8216;t\u00ecm t\u00e0i li\u1ec7u c\u00f3 X&#8217;)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Th\u1ef1c h\u00e0nh t\u1ed1t nh\u1ea5t l\u00e0 s\u1eed d\u1ee5ng filter khi c\u00f3 th\u1ec3 (\u0111\u1eb7c bi\u1ec7t cho truy v\u1ea5n ch\u00ednh x\u00e1c nh\u01b0 term, range) v\u00e0 ch\u1ec9 s\u1eed d\u1ee5ng query khi c\u1ea7n x\u1ebfp h\u1ea1ng k\u1ebft qu\u1ea3 theo m\u1ee9c \u0111\u1ed9 li\u00ean quan.<\/span><\/p>\n<h3><b>Tokenizer trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Elasticsearch, tokenizer l\u00e0 tr\u00ecnh ph\u00e2n t\u00edch c\u00fa ph\u00e1p, ch\u1ecbu tr\u00e1ch nhi\u1ec7m chia nh\u1ecf v\u0103n b\u1ea3n th\u00e0nh c\u00e1c token ri\u00eang l\u1ebb trong qu\u00e1 tr\u00ecnh l\u1eadp index. Tokenization l\u00e0 m\u1ed9t b\u01b0\u1edbc quan tr\u1ecdng trong qu\u00e1 tr\u00ecnh ph\u00e2n t\u00edch, trong \u0111\u00f3 v\u0103n b\u1ea3n \u0111\u01b0\u1ee3c chia th\u00e0nh c\u00e1c \u0111\u01a1n v\u1ecb ho\u1eb7c token c\u00f3 \u00fd ngh\u0129a c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm hi\u1ec7u qu\u1ea3.<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1ed9t s\u1ed1 tokenizer trong Elasticsearch nh\u01b0:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Standard tokenizer:<\/b><span style=\"font-weight: 400;\"> Standard tokenizer l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 ph\u00e2n t\u00edch c\u00fa ph\u00e1p \u0111a n\u0103ng, ho\u1ea1t \u0111\u1ed9ng t\u1ed1t v\u1edbi h\u1ea7u h\u1ebft c\u00e1c ng\u00f4n ng\u1eef. C\u00f4ng c\u1ee5 n\u00e0y chia nh\u1ecf v\u0103n b\u1ea3n th\u00e0nh c\u00e1c t\u1eeb ri\u00eang l\u1ebb, c\u00f3 t\u00ednh \u0111\u1ebfn ng\u1eef ph\u00e1p v\u00e0 d\u1ea5u c\u00e2u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Whitespace tokenizer:<\/b><span style=\"font-weight: 400;\"> Ph\u00e2n t\u00edch kho\u1ea3ng tr\u1eafng chia nh\u1ecf v\u0103n b\u1ea3n th\u00e0nh c\u00e1c t\u1eeb ri\u00eang l\u1ebb d\u1ef1a tr\u00ean c\u00e1c k\u00fd t\u1ef1 kho\u1ea3ng tr\u1eafng, ch\u1eb3ng h\u1ea1n nh\u01b0 kho\u1ea3ng tr\u1eafng, tab v\u00e0 xu\u1ed1ng d\u00f2ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Keyword tokenizer:<\/b><span style=\"font-weight: 400;\"> Keyword tokenizer kh\u00f4ng th\u1ef1c hi\u1ec7n b\u1ea5t k\u1ef3 vi\u1ec7c lo\u1ea1i b\u1ecf t\u1eeb g\u1ed1c ho\u1eb7c stopword n\u00e0o m\u00e0 ch\u1ec9 \u0111\u01a1n gi\u1ea3n l\u00e0 chia nh\u1ecf v\u0103n b\u1ea3n th\u00e0nh c\u00e1c t\u1eeb ri\u00eang l\u1ebb v\u00e0 kh\u00f4ng c\u1ea7n x\u1eed l\u00fd th\u00eam.<\/span><\/li>\n<\/ul>\n<h3><b>Li\u1ec7t k\u00ea c\u00e1c API Elasticsearch quan tr\u1ecdng<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Index API:<\/b><span style=\"font-weight: 400;\"> Index API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o, c\u1eadp nh\u1eadt v\u00e0 x\u00f3a c\u00e1c index. M\u1ed9t index l\u00e0 m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c t\u00e0i li\u1ec7u chia s\u1ebb c\u00f9ng m\u1ed9t l\u01b0\u1ee3c \u0111\u1ed3. L\u01b0\u1ee3c \u0111\u1ed3 x\u00e1c \u0111\u1ecbnh c\u1ea5u tr\u00fac c\u1ee7a c\u00e1c t\u00e0i li\u1ec7u trong index.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Document API:<\/b><span style=\"font-weight: 400;\"> Document API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o, c\u1eadp nh\u1eadt v\u00e0 x\u00f3a t\u00e0i li\u1ec7u. T\u00e0i li\u1ec7u l\u00e0 m\u1ed9t ph\u1ea7n d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong index. T\u00e0i li\u1ec7u c\u00f3 th\u1ec3 thu\u1ed9c b\u1ea5t k\u1ef3 lo\u1ea1i n\u00e0o, nh\u01b0ng ch\u00fang th\u01b0\u1eddng l\u00e0 c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Search API:<\/b><span style=\"font-weight: 400;\"> API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u00ecm ki\u1ebfm t\u00e0i li\u1ec7u. Search API cho ph\u00e9p b\u1ea1n ch\u1ec9 \u0111\u1ecbnh m\u1ed9t truy v\u1ea5n, l\u00e0 m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c ti\u00eau ch\u00ed m\u00e0 t\u00e0i li\u1ec7u ph\u1ea3i kh\u1edbp \u0111\u1ec3 \u0111\u01b0\u1ee3c tr\u1ea3 v\u1ec1.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Aggregation API:<\/b><span style=\"font-weight: 400;\"> API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ed5ng h\u1ee3p k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm. Aggregation API cho ph\u00e9p b\u1ea1n nh\u00f3m c\u00e1c k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm l\u1ea1i v\u1edbi nhau v\u00e0 t\u00ednh to\u00e1n s\u1ed1 li\u1ec7u th\u1ed1ng k\u00ea t\u00f3m t\u1eaft.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Cat API: <\/b><span style=\"font-weight: 400;\">Cat API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u1ea5y th\u00f4ng tin v\u1ec1 index, t\u00e0i li\u1ec7u v\u00e0 shard. Cat API cung c\u1ea5p nhi\u1ec1u th\u00f4ng tin kh\u00e1c nhau, ch\u1eb3ng h\u1ea1n nh\u01b0 s\u1ed1 l\u01b0\u1ee3ng t\u00e0i li\u1ec7u trong index, k\u00edch th\u01b0\u1edbc index v\u00e0 s\u1ed1 l\u01b0\u1ee3ng shard trong index.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Cluster API:<\/b><span style=\"font-weight: 400;\"> \u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 qu\u1ea3n l\u00fd v\u00e0 gi\u00e1m s\u00e1t ho\u1ea1t \u0111\u1ed9ng c\u1ee7a cluster, bao g\u1ed3m th\u00f4ng tin v\u1ec1 tr\u1ea1ng th\u00e1i s\u1ee9c kh\u1ecfe, hi\u1ec7u su\u1ea5t v\u00e0 c\u1ea5u h\u00ecnh c\u1ee7a cluster.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Snapshot API:<\/b><span style=\"font-weight: 400;\"> Cho ph\u00e9p b\u1ea1n sao l\u01b0u v\u00e0 kh\u00f4i ph\u1ee5c d\u1eef li\u1ec7u th\u00f4ng qua vi\u1ec7c t\u1ea1o v\u00e0 qu\u1ea3n l\u00fd snapshot c\u1ee7a index ho\u1eb7c to\u00e0n b\u1ed9 cluster.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ingest API:<\/b><span style=\"font-weight: 400;\"> Cho ph\u00e9p b\u1ea1n \u0111\u1ecbnh ngh\u0129a v\u00e0 qu\u1ea3n l\u00fd c\u00e1c pipeline x\u1eed l\u00fd d\u1eef li\u1ec7u tr\u01b0\u1edbc khi l\u1eadp index, h\u1ed7 tr\u1ee3 chuy\u1ec3n \u0111\u1ed5i v\u00e0 l\u00e0m gi\u00e0u d\u1eef li\u1ec7u.<\/span><\/li>\n<\/ul>\n<h3><b> S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa Elasticsearch v\u00e0 Solr l\u00e0 g\u00ec?<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>N\u1ed9i dung<\/b><\/td>\n<td><b>Elasticsearch<\/b><\/td>\n<td><b>Solr<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>T\u00ecm ki\u1ebfm v\u00e0 l\u1eadp index theo th\u1eddi gian th\u1ef1c<\/b><\/td>\n<td><span style=\"font-weight: 400;\">Elasticsearch t\u1eadp trung nhi\u1ec1u v\u00e0o kh\u1ea3 n\u0103ng l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm g\u1ea7n th\u1eddi gian th\u1ef1c, cho ph\u00e9p l\u1eadp index v\u00e0 truy xu\u1ea5t t\u00e0i li\u1ec7u r\u1ea5t nhanh.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Solr h\u1ed7 tr\u1ee3 l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm theo th\u1eddi gian th\u1ef1c nh\u01b0ng trong m\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p c\u00f3 th\u1ec3 kh\u00f4ng nhanh ho\u1eb7c t\u00ednh h\u1ee3p l\u00fd kh\u00f4ng cao nh\u01b0 Elasticsearch.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Schema (l\u01b0\u1ee3c \u0111\u1ed3)<\/b><\/td>\n<td><span style=\"font-weight: 400;\">Elasticsearch m\u1eb7c \u0111\u1ecbnh kh\u00f4ng c\u00f3 schema, h\u1ed7 tr\u1ee3 \u00e1nh x\u1ea1 t\u1ef1 \u0111\u1ed9ng suy ra c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u v\u00e0 tr\u01b0\u1eddng.\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Solr y\u00eau c\u1ea7u m\u1ed9t schema \u0111\u01b0\u1ee3c x\u00e1c \u0111\u1ecbnh tr\u01b0\u1edbc, m\u1eb7c d\u00f9 c\u00e1c phi\u00ean b\u1ea3n g\u1ea7n \u0111\u00e2y \u0111\u01b0\u1ee3c gi\u1edbi thi\u1ec7u h\u1ed7 tr\u1ee3 cho c\u00e1c tr\u01b0\u1eddng \u0111\u1ed9ng v\u00e0 ho\u1ea1t \u0111\u1ed9ng kh\u00f4ng c\u00f3 schema.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>T\u1ed5ng h\u1ee3p<\/b><\/td>\n<td><span style=\"font-weight: 400;\">Elasticsearch cung c\u1ea5p m\u1ed9t khu\u00f4n kh\u1ed5 t\u1ed5ng h\u1ee3p to\u00e0n di\u1ec7n cho ph\u00e9p ph\u00e2n t\u00edch d\u1eef li\u1ec7u ph\u1ee9c t\u1ea1p, t\u00f3m t\u1eaft v\u00e0 tr\u1ef1c quan h\u00f3a d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u1eadp index.\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Solr c\u00f3 c\u00e1c th\u00e0nh ph\u1ea7n Faceting v\u00e0 Stats, nh\u01b0ng kh\u1ea3 n\u0103ng b\u1ecb h\u1ea1n ch\u1ebf h\u01a1n so v\u1edbi c\u00e1c t\u1ed5ng h\u1ee3p c\u1ee7a Elasticsearch.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>C\u1ed9ng \u0111\u1ed3ng v\u00e0 h\u1ed7 tr\u1ee3<\/b><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 c\u1ed9ng \u0111\u1ed3ng l\u1edbn v\u00e0 h\u1ed7 tr\u1ee3 th\u01b0\u01a1ng m\u1ea1i t\u1eeb Elastic.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">L\u00e0 m\u1ed9t d\u1ef1 \u00e1n Apache v\u1edbi c\u1ed9ng \u0111\u1ed3ng m\u00e3 ngu\u1ed3n m\u1edf.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng<\/b><\/td>\n<td><span style=\"font-weight: 400;\">\u0110\u01b0\u1ee3c thi\u1ebft k\u1ebf t\u1eeb \u0111\u1ea7u \u0111\u1ec3 ph\u00e2n t\u00e1n v\u00e0 m\u1edf r\u1ed9ng theo chi\u1ec1u ngang.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 th\u1ec3 m\u1edf r\u1ed9ng nh\u01b0ng y\u00eau c\u1ea7u c\u1ea5u h\u00ecnh ph\u1ee9c t\u1ea1p h\u01a1n.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Giao di\u1ec7n ng\u01b0\u1eddi d\u00f9ng<\/b><\/td>\n<td><span style=\"font-weight: 400;\">Elasticsearch t\u00edch h\u1ee3p v\u1edbi Kibana \u0111\u1ec3 tr\u1ef1c quan h\u00f3a d\u1eef li\u1ec7u.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 Solr Admin UI nh\u01b0ng th\u01b0\u1eddng k\u00e9m m\u1ea1nh m\u1ebd h\u01a1n.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>M\u1ee5c \u0111\u00edch c\u1ee7a h\u00e0m match query l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">H\u00e0m match query trong Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u00ecm ki\u1ebfm c\u00e1c t\u00e0i li\u1ec7u c\u00f3 ch\u1ee9a m\u1ed9t gi\u00e1 tr\u1ecb c\u1ee5 th\u1ec3. Match query c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u00ecm ki\u1ebfm c\u00e1c t\u00e0i li\u1ec7u c\u00f3 ch\u1ee9a m\u1ed9t chu\u1ed7i c\u1ee5 th\u1ec3, m\u1ed9t s\u1ed1 c\u1ee5 th\u1ec3 ho\u1eb7c m\u1ed9t ng\u00e0y c\u1ee5 th\u1ec3. Match query c\u00f3 hai \u0111\u1ed1i s\u1ed1: t\u00ean tr\u01b0\u1eddng v\u00e0 gi\u00e1 tr\u1ecb c\u1ea7n t\u00ecm ki\u1ebfm. T\u00ean tr\u01b0\u1eddng l\u00e0 &#8216;t\u00ean c\u1ee7a tr\u01b0\u1eddng&#8217; trong t\u00e0i li\u1ec7u b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm. Gi\u00e1 tr\u1ecb l\u00e0 gi\u00e1 tr\u1ecb b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET \/my_index\/_search<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"match\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"title\": \"elasticsearch guide\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Trong v\u00ed d\u1ee5 n\u00e0y, Elasticsearch s\u1ebd t\u00ecm t\u1ea5t c\u1ea3 t\u00e0i li\u1ec7u c\u00f3 ch\u1ee9a t\u1eeb &#8216;elasticsearch&#8217; ho\u1eb7c &#8216;guide&#8217; trong tr\u01b0\u1eddng &#8216;title&#8217;. Match query m\u1eb7c \u0111\u1ecbnh s\u1eed d\u1ee5ng to\u00e1n t\u1eed OR gi\u1eefa c\u00e1c t\u1eeb, nh\u01b0ng c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh \u0111\u1ec3 s\u1eed d\u1ee5ng AND.<\/span><\/p>\n<h3><b>Gi\u1ea3i th\u00edch m\u1ee5c \u0111\u00edch c\u1ee7a h\u00e0m truy v\u1ea5n <\/b><b>&#8216;exists&#8217;<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">H\u00e0m truy v\u1ea5n <\/span><span style=\"font-weight: 400;\">&#8216;exists&#8217;<\/span><span style=\"font-weight: 400;\"> trong Elasticsearch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ki\u1ec3m tra xem m\u1ed9t tr\u01b0\u1eddng c\u1ee5 th\u1ec3 c\u00f3 t\u1ed3n t\u1ea1i trong t\u00e0i li\u1ec7u hay kh\u00f4ng. H\u00e0m n\u00e0y \u0111\u1eb7c bi\u1ec7t h\u1eefu \u00edch khi b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm t\u00e0i li\u1ec7u d\u1ef1a tr\u00ean s\u1ef1 c\u00f3 m\u1eb7t ho\u1eb7c v\u1eafng m\u1eb7t c\u1ee7a m\u1ed9t tr\u01b0\u1eddng nh\u1ea5t \u0111\u1ecbnh. Truy v\u1ea5n<\/span><span style=\"font-weight: 400;\"> &#8216;exists&#8217;<\/span><span style=\"font-weight: 400;\"> c\u00f3 m\u1ed9t \u0111\u1ed1i s\u1ed1: t\u00ean tr\u01b0\u1eddng. T\u00ean tr\u01b0\u1eddng l\u00e0 t\u00ean c\u1ee7a tr\u01b0\u1eddng m\u00e0 b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm.<\/span><\/p>\n<h3><b>M\u1ee5c \u0111\u00edch c\u1ee7a bool query v\u00e0 c\u00e1c m\u1ec7nh \u0111\u1ec1 ch\u00ednh c\u1ee7a bool query trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Truy v\u1ea5n boolean trong Elasticsearch l\u00e0 truy v\u1ea5n s\u1eed d\u1ee5ng to\u00e1n t\u1eed boolean \u0111\u1ec3 k\u1ebft h\u1ee3p nhi\u1ec1u truy v\u1ea5n th\u00e0nh m\u1ed9t truy v\u1ea5n duy nh\u1ea5t. C\u00e1c m\u1ec7nh \u0111\u1ec1 ch\u00ednh c\u1ee7a truy v\u1ea5n boolean l\u00e0:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">must<\/span><span style=\"font-weight: 400;\"> &#8211; M\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">must <\/span><span style=\"font-weight: 400;\">ch\u1ec9 \u0111\u1ecbnh c\u00e1c t\u00e0i li\u1ec7u kh\u1edbp v\u1edbi truy v\u1ea5n. T\u1ea5t c\u1ea3 c\u00e1c t\u00e0i li\u1ec7u kh\u00f4ng kh\u1edbp v\u1edbi m\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">must <\/span><span style=\"font-weight: 400;\">s\u1ebd b\u1ecb lo\u1ea1i kh\u1ecfi k\u1ebft qu\u1ea3.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">should<\/span><span style=\"font-weight: 400;\"> &#8211; M\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">should <\/span><span style=\"font-weight: 400;\">ch\u1ec9 \u0111\u1ecbnh c\u00e1c t\u00e0i li\u1ec7u ph\u1ea3i kh\u1edbp v\u1edbi truy v\u1ea5n. C\u00e1c t\u00e0i li\u1ec7u kh\u1edbp v\u1edbi m\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">should <\/span><span style=\"font-weight: 400;\">s\u1ebd \u0111\u01b0\u1ee3c \u0111\u01b0a v\u00e0o k\u1ebft qu\u1ea3, ngay c\u1ea3 khi ch\u00fang kh\u00f4ng kh\u1edbp v\u1edbi m\u1ec7nh \u0111\u1ec1 must.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">must_not<\/span><span style=\"font-weight: 400;\"> &#8211; M\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">must_not<\/span><span style=\"font-weight: 400;\"> ch\u1ec9 \u0111\u1ecbnh c\u00e1c t\u00e0i li\u1ec7u kh\u00f4ng kh\u1edbp v\u1edbi truy v\u1ea5n. T\u1ea5t c\u1ea3 c\u00e1c t\u00e0i li\u1ec7u kh\u1edbp v\u1edbi m\u1ec7nh \u0111\u1ec1 <\/span><span style=\"font-weight: 400;\">must_not<\/span><span style=\"font-weight: 400;\"> s\u1ebd b\u1ecb lo\u1ea1i kh\u1ecfi k\u1ebft qu\u1ea3.<\/span><\/li>\n<\/ul>\n<h3><b>C\u00e1ch th\u1ee9c ho\u1ea1t \u0111\u1ed9ng c\u1ee7a ch\u1ee9c n\u0103ng x\u00f3a t\u1ef1 \u0111\u1ed9ng c\u00e1c index c\u0169 trong Elasticsearch rollover node?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Trong Elasticsearch, quy tr\u00ecnh rollover \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng qu\u1ea3n l\u00fd v\u00e0 x\u00f3a c\u00e1c index c\u0169 nh\u1eb1m \u0111\u1ea3m b\u1ea3o t\u1ed5 ch\u1ee9c d\u1eef li\u1ec7u v\u00e0 s\u1eed d\u1ee5ng t\u00e0i nguy\u00ean hi\u1ec7u qu\u1ea3. M\u1ed9t rollover node \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh th\u1ef1c hi\u1ec7n thao t\u00e1c rollover. M\u1ed9t s\u1ed1 kh\u00eda c\u1ea1nh li\u00ean quan \u0111\u1ebfn vi\u1ec7c x\u00f3a c\u00e1c index c\u0169 nh\u01b0 sau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Qu\u1ea3n l\u00fd v\u00f2ng \u0111\u1eddi index (Index Lifecycle Management &#8211; ILM): Vi\u1ec7c t\u1ef1 \u0111\u1ed9ng x\u00f3a c\u00e1c index c\u0169 th\u01b0\u1eddng \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n th\u00f4ng qua vi\u1ec7c s\u1eed d\u1ee5ng ILM trong Elasticsearch.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u0110i\u1ec1u ki\u1ec7n chuy\u1ec3n ti\u1ebfp: Khi c\u1ea5u h\u00ecnh ch\u00ednh s\u00e1ch ILM, b\u1ea1n s\u1ebd x\u00e1c \u0111\u1ecbnh c\u00e1c \u0111i\u1ec1u ki\u1ec7n k\u00edch ho\u1ea1t quy tr\u00ecnh chuy\u1ec3n ti\u1ebfp.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ho\u1ea1t \u0111\u1ed9ng chuy\u1ec3n nh\u01b0\u1ee3ng: Khi c\u00e1c \u0111i\u1ec1u ki\u1ec7n chuy\u1ec3n nh\u01b0\u1ee3ng \u0111\u01b0\u1ee3c \u0111\u00e1p \u1ee9ng, quy tr\u00ecnh chuy\u1ec3n nh\u01b0\u1ee3ng s\u1ebd \u0111\u01b0\u1ee3c k\u00edch ho\u1ea1t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u01b0u gi\u1eef v\u00e0 x\u00f3a: L\u00e0 m\u1ed9t ph\u1ea7n c\u1ee7a ch\u00ednh s\u00e1ch ILM, b\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh th\u1eddi gian l\u01b0u gi\u1eef cho c\u00e1c index.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ph\u01b0\u01a1ng ph\u00e1p x\u00f3a: Elasticsearch cung c\u1ea5p nhi\u1ec1u c\u01a1 ch\u1ebf kh\u00e1c nhau \u0111\u1ec3 x\u00f3a index c\u0169, t\u00f9y thu\u1ed9c v\u00e0o y\u00eau c\u1ea7u c\u1ee7a b\u1ea1n.<\/span><\/li>\n<\/ul>\n<h3><b> Elasticsearch x\u1eed l\u00fd vi\u1ec7c l\u1eadp index t\u00e0i li\u1ec7u kh\u00f4ng c\u00f3 l\u01b0\u1ee3c \u0111\u1ed3 nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 t\u00ecm ki\u1ebfm d\u1ef1a tr\u00ean t\u00e0i li\u1ec7u kh\u00f4ng c\u00f3 l\u01b0\u1ee3c \u0111\u1ed3. \u0110i\u1ec1u n\u00e0y c\u00f3 ngh\u0129a l\u00e0 b\u1ea1n kh\u00f4ng c\u1ea7n ph\u1ea3i x\u00e1c \u0111\u1ecbnh l\u01b0\u1ee3c \u0111\u1ed3 cho t\u00e0i li\u1ec7u c\u1ee7a m\u00ecnh tr\u01b0\u1edbc khi l\u1eadp index cho ch\u00fang. B\u1ea1n ch\u1ec9 c\u1ea7n l\u1eadp index t\u00e0i li\u1ec7u d\u01b0\u1edbi d\u1ea1ng \u0111\u1ed1i t\u01b0\u1ee3ng JSON, Elasticsearch s\u1ebd t\u1ef1 \u0111\u1ed9ng t\u1ea1o l\u01b0\u1ee3c \u0111\u1ed3 cho b\u1ea1n.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Khi b\u1ea1n l\u1eadp index m\u1ed9t t\u00e0i li\u1ec7u, Elasticsearch s\u1ebd t\u1ea1o m\u1ed9t mapping cho t\u00e0i li\u1ec7u. Mapping n\u00e0y x\u00e1c \u0111\u1ecbnh c\u00e1c tr\u01b0\u1eddng trong t\u00e0i li\u1ec7u v\u00e0 type c\u1ee7a ch\u00fang. Elasticsearch s\u1ebd s\u1eed d\u1ee5ng mapping n\u00e0y \u0111\u1ec3 l\u1eadp index t\u00e0i li\u1ec7u v\u00e0 t\u00ecm ki\u1ebfm t\u00e0i li\u1ec7u.<\/span><\/p>\n<h3><b>Inverted index trong ElasticSearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch s\u1eed d\u1ee5ng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u gi\u1ed1ng nh\u01b0 hashmap \u0111\u01b0\u1ee3c g\u1ecdi l\u00e0 inverted index cho ph\u00e9p t\u00ecm ki\u1ebfm to\u00e0n v\u0103n nhanh ch\u00f3ng. Inverted index li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 c\u00e1c t\u1eeb duy nh\u1ea5t xu\u1ea5t hi\u1ec7n trong m\u1ed9t ho\u1eb7c nhi\u1ec1u t\u00e0i li\u1ec7u v\u00e0 x\u00e1c \u0111\u1ecbnh t\u1ea5t c\u1ea3 t\u00e0i li\u1ec7u m\u00e0 c\u00e1c t\u1eeb \u0111\u00f3 xu\u1ea5t hi\u1ec7n. B\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm nhanh tr\u00ean h\u00e0ng tri\u1ec7u t\u00e0i li\u1ec7u \u0111\u1ec3 t\u00ecm d\u1eef li\u1ec7u c\u00f3 li\u00ean quan.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Gi\u1ea3 s\u1eed b\u1ea1n c\u00f3 hai t\u00e0i li\u1ec7u kh\u00e1c nhau:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">ITviec is a good hiring company.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">That is one of the good companies.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">C\u00e1c v\u0103n b\u1ea3n tr\u00ean \u0111\u00e3 \u0111\u01b0\u1ee3c tokenizer th\u00e0nh c\u00e1c term ri\u00eang bi\u1ec7t cho m\u1ee5c \u0111\u00edch l\u1eadp index. T\u1ea5t c\u1ea3 c\u00e1c term duy nh\u1ea5t sau \u0111\u00f3 \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong index, c\u00f9ng v\u1edbi th\u00f4ng tin nh\u01b0 t\u00e0i li\u1ec7u ch\u1ee9a term \u0111\u00f3, v\u1ecb tr\u00ed c\u1ee7a n\u00f3, c\u0169ng nh\u01b0 t\u1ea7n su\u1ea5t xu\u1ea5t hi\u1ec7n. Theo \u0111\u00f3, inverted index nh\u01b0 sau:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Term<\/b><\/td>\n<td><b>Frequency<\/b><\/td>\n<td><b>Document<\/b><\/td>\n<td><b>Document: Position<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">ITviec<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:1<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">is<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1,2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:2,1:2<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">a<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:3<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">good<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1,2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:4,2:6<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">hiring<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:5<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Company<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1:6<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">That<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2:1<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">one<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2:3<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">of<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2:4<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">a<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2:5<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">companies<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2:7<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Gi\u1ea3 s\u1eed b\u1ea1n \u0111ang t\u00ecm ki\u1ebfm m\u1ed9t thu\u1eadt ng\u1eef company ho\u1eb7c companies. V\u1edbi inverted index n\u00e0y, c\u00e1c truy v\u1ea5n c\u00f3 th\u1ec3 t\u00ecm ki\u1ebfm thu\u1eadt ng\u1eef v\u00e0 nhanh ch\u00f3ng x\u00e1c \u0111\u1ecbnh c\u00e1c t\u00e0i li\u1ec7u c\u00f3 ch\u1ee9a thu\u1eadt ng\u1eef n\u00e0y.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_phong_van_Elasticsearch_cap_cao\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch c\u1ea5p cao<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b> L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 t\u00ecm ki\u1ebfm tr\u00ean nhi\u1ec1u tr\u01b0\u1eddng trong Elasticsearch?<\/b><\/h3>\n<pre><span style=\"font-weight: 400;\">GET \/my_index\/_search<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"multi_match\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"query\": \"search text\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"fields\": [\"field1\", \"field2\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> M\u1ee5c \u0111\u00edch c\u1ee7a c\u00e1c index template trong Elasticsearch l\u00e0 g\u00ec v\u00e0 ch\u00fang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Index template trong Elasticsearch x\u00e1c \u0111\u1ecbnh c\u00e1c thi\u1ebft l\u1eadp, mapping v\u00e0 alias cho c\u00e1c index kh\u1edbp v\u1edbi m\u1ed9t template. Ch\u00fang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u00e1p d\u1ee5ng c\u00e1c c\u1ea5u h\u00ecnh t\u1ef1 \u0111\u1ed9ng khi c\u00e1c index m\u1edbi \u0111\u01b0\u1ee3c t\u1ea1o. V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"index_patterns\": [\"log-*\"],<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"settings\": { \"number_of_shards\": 1 },<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"mappings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"properties\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"host_name\": { \"type\": \"keyword\" },<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"created_at\": { \"type\": \"date\" }<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">T\u1eeb Elasticsearch 7.8 tr\u1edf l\u00ean, ch\u00fang ta c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng component templates k\u1ebft h\u1ee3p v\u1edbi composed index templates \u0111\u1ec3 t\u1ea1o c\u1ea5u tr\u00fac m\u1eabu c\u00f3 th\u1ec3 t\u00e1i s\u1eed d\u1ee5ng.<\/span><\/p>\n<h3><b> L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 l\u1eadp index l\u1ea1i d\u1eef li\u1ec7u trong Elasticsearch b\u1eb1ng c\u00e1ch chuy\u1ec3n \u0111\u1ed5i t\u00f9y ch\u1ec9nh?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng Reindex API v\u1edbi ingest pipeline \u0111\u1ec3 chuy\u1ec3n \u0111\u1ed5i:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT _ingest\/pipeline\/custom_pipeline<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"description\": \"Custom pipeline\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"processors\": [<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0{ \"set\": { \"field\": \"new_field\", \"value\": \"new_value\" } }<\/span>\n<span style=\"font-weight: 400;\"> \u00a0]<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n<span style=\"font-weight: 400;\">POST _reindex<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"source\u201d: {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\"index\": \"source_index\"<\/span>\n<span style=\"font-weight: 400;\">},<\/span>\n<span style=\"font-weight: 400;\">\"dest\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"index\": \"destination_index\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"pipeline\": \"custom_pipeline\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> C\u1ea5u h\u00ecnh Elasticsearch nh\u01b0 th\u1ebf n\u00e0o \u0111\u1ec3 s\u1eed d\u1ee5ng thu\u1eadt to\u00e1n t\u01b0\u01a1ng t\u1ef1 t\u00f9y ch\u1ec9nh nh\u1eb1m x\u1ebfp h\u1ea1ng t\u00e0i li\u1ec7u trong k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 c\u1ea5u h\u00ecnh Elasticsearch s\u1eed d\u1ee5ng thu\u1eadt to\u00e1n t\u01b0\u01a1ng t\u1ef1 t\u00f9y ch\u1ec9nh \u0111\u1ec3 x\u1ebfp h\u1ea1ng t\u00e0i li\u1ec7u trong k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm, b\u1ea1n s\u1ebd ph\u1ea3i x\u00e1c \u0111\u1ecbnh m\u1ee9c \u0111\u1ed9 t\u01b0\u01a1ng t\u1ef1 t\u00f9y ch\u1ec9nh trong c\u00e0i \u0111\u1eb7t index v\u00e0 \u00e1p d\u1ee5ng n\u00f3 v\u00e0o mapping tr\u01b0\u1eddng.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/my_index<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"settings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"similarity\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"custom_similarity\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"BM25\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"k1\": 2,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"b\": 0.75<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"mappings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"properties\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"field1\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"text\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"similarity\": \"custom_similarity\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>C\u00f3 th\u1ec3 \u00e1p d\u1ee5ng h\u1ec7 s\u1ed1 t\u0103ng c\u01b0\u1eddng cho m\u1ed9t tr\u01b0\u1eddng c\u1ee5 th\u1ec3 trong qu\u00e1 tr\u00ecnh th\u1ef1c hi\u1ec7n truy v\u1ea5n t\u00ecm ki\u1ebfm kh\u00f4ng?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 \u00e1p d\u1ee5ng h\u1ec7 s\u1ed1 t\u0103ng c\u01b0\u1eddng cho m\u1ed9t tr\u01b0\u1eddng c\u1ee5 th\u1ec3 trong qu\u00e1 tr\u00ecnh th\u1ef1c hi\u1ec7n truy v\u1ea5n t\u00ecm ki\u1ebfm, b\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng thu\u1ed9c t\u00ednh t\u0103ng c\u01b0\u1eddng tr\u00ean truy v\u1ea5n kh\u1edbp.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET \/my_index\/_search<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\"multi_match\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"query\": \"search phrase\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"fields\": [\"field1\", \"field2^2\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> S\u1ef1 kh\u00e1c nhau gi\u1eefa Elasticsearch v\u00e0 Apache Kafka l\u00e0 g\u00ec?\u00a0<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch v\u00e0 Apache Kafka \u0111\u1ec1u l\u00e0 c\u00f4ng ngh\u1ec7 ngu\u1ed3n m\u1edf \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u1eed l\u00fd v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u. Tuy nhi\u00ean, ch\u00fang c\u00f3 m\u1ee5c \u0111\u00edch v\u00e0 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng kh\u00e1c nhau.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Data type: Elasticsearch \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 l\u1eadp index v\u00e0 t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u v\u0103n b\u1ea3n. Apache Kafka \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u1eed l\u00fd v\u00e0 ph\u00e2n ph\u1ed1i b\u1ea5t k\u1ef3 lo\u1ea1i d\u1eef li\u1ec7u n\u00e0o, bao g\u1ed3m v\u0103n b\u1ea3n, d\u1eef li\u1ec7u nh\u1ecb ph\u00e2n v\u00e0 d\u1eef li\u1ec7u c\u00f3 c\u1ea5u tr\u00fac.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00e1c tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng: Elasticsearch th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ph\u00e2n t\u00edch nh\u1eadt k\u00fd, ph\u00e2n t\u00edch th\u1eddi gian th\u1ef1c v\u00e0 t\u00ecm ki\u1ebfm to\u00e0n v\u0103n. Apache Kafka th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 ph\u00e1t tr\u1ef1c tuy\u1ebfn s\u1ef1 ki\u1ec7n, t\u00edch h\u1ee3p d\u1eef li\u1ec7u v\u00e0 ph\u00e2n t\u00edch ph\u00e1t tr\u1ef1c tuy\u1ebfn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Hi\u1ec7u su\u1ea5t: Elasticsearch c\u00f3 hi\u1ec7u su\u1ea5t cao cho c\u00e1c truy v\u1ea5n t\u00ecm ki\u1ebfm. Apache Kafka mang l\u1ea1i hi\u1ec7u su\u1ea5t cao cho d\u1eef li\u1ec7u ph\u00e1t tr\u1ef1c tuy\u1ebfn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u01b0u tr\u1eef d\u1eef li\u1ec7u: Elasticsearch cung c\u1ea5p kh\u1ea3 n\u0103ng l\u01b0u tr\u1eef d\u1eef li\u1ec7u c\u00f3 th\u1ec3 c\u1ea5u h\u00ecnh nh\u01b0ng kh\u00f4ng \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 l\u01b0u tr\u1eef d\u1eef li\u1ec7u l\u00e2u d\u00e0i. Kafka cung c\u1ea5p kh\u1ea3 n\u0103ng l\u01b0u tr\u1eef d\u1eef li\u1ec7u l\u00e2u d\u00e0i v\u00e0 b\u1ec1n v\u1eefng.<\/span><\/li>\n<\/ul>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/kafka-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Kafka l\u00e0 g\u00ec? Nh\u1eefng l\u1ee3i \u00edch tuy\u1ec7t v\u1eddi m\u00e0 Kafka mang l\u1ea1i cho Dev<\/strong><\/a><\/em><\/p><\/blockquote>\n<h3><b> Elasticsearch x\u1eed l\u00fd c\u00e1c tr\u01b0\u1eddng d\u1eef li\u1ec7u h\u00ecnh h\u1ecdc v\u00e0 v\u1ecb tr\u00ed \u0111\u1ecba l\u00fd nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Elasticsearch h\u1ed7 tr\u1ee3 m\u1ea1nh m\u1ebd cho c\u00e1c tr\u01b0\u1eddng d\u1eef li\u1ec7u \u0111\u1ecba l\u00fd v\u00e0 h\u00ecnh h\u1ecdc, cho ph\u00e9p b\u1ea1n l\u1eadp index, t\u00ecm ki\u1ebfm v\u00e0 th\u1ef1c hi\u1ec7n c\u00e1c ho\u1ea1t \u0111\u1ed9ng kh\u00f4ng gian tr\u00ean d\u1eef li\u1ec7u kh\u00f4ng gian. Elasticsearch x\u1eed l\u00fd c\u00e1c tr\u01b0\u1eddng d\u1eef li\u1ec7u \u0111\u1ecba l\u00fd v\u00e0 h\u00ecnh h\u1ecdc b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u <\/span><span style=\"font-weight: 400;\">geo_point<\/span><span style=\"font-weight: 400;\"> v\u00e0 <\/span><span style=\"font-weight: 400;\">geo_shape<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3u d\u1eef li\u1ec7u <\/span><span style=\"font-weight: 400;\">geo_point<\/span><span style=\"font-weight: 400;\"> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef t\u1ecda \u0111\u1ed9 v\u0129 \u0111\u1ed9 v\u00e0 kinh \u0111\u1ed9, trong khi <\/span><span style=\"font-weight: 400;\">geo_shape<\/span><span style=\"font-weight: 400;\"> c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u01b0u tr\u1eef nhi\u1ec1u d\u1ea1ng h\u00ecnh h\u1ecdc kh\u00e1c nhau, ch\u1eb3ng h\u1ea1n nh\u01b0 \u0111i\u1ec3m, \u0111\u01b0\u1eddng, \u0111a gi\u00e1c v\u00e0 h\u00ecnh tr\u00f2n.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET \/my_index\/_search<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"geo_distance\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"distance\": \"5km\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"location\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"lat\": 40.73,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"lon\": -74.1<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b>C\u00f3 c\u1ea7n thi\u1ebft ph\u1ea3i c\u00e0i \u0111\u1eb7t X-Pack cho Elasticsearch kh\u00f4ng? M\u1ed9t s\u1ed1 l\u1ec7nh X-pack c\u1ea7n thi\u1ebft l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">X-Pack kh\u00f4ng c\u00f2n l\u00e0 m\u1ed9t ph\u1ea7n c\u00e0i \u0111\u1eb7t ri\u00eang bi\u1ec7t. T\u1eeb Elasticsearch 6.3 tr\u1edf \u0111i, X-Pack \u0111\u01b0\u1ee3c t\u00edch h\u1ee3p s\u1eb5n v\u00e0o Elasticsearch v\u00e0 Kibana. C\u00e1c t\u00ednh n\u0103ng c\u01a1 b\u1ea3n c\u1ee7a X-Pack (nh\u01b0 gi\u00e1m s\u00e1t c\u01a1 b\u1ea3n) \u0111\u01b0\u1ee3c bao g\u1ed3m mi\u1ec5n ph\u00ed, trong khi c\u00e1c t\u00ednh n\u0103ng n\u00e2ng cao (nh\u01b0 b\u1ea3o m\u1eadt, c\u1ea3nh b\u00e1o, h\u1ecdc m\u00e1y) y\u00eau c\u1ea7u gi\u1ea5y ph\u00e9p tr\u1ea3 ph\u00ed. V\u1ec1 b\u1ea3n ch\u1ea5t, X-Pack l\u00e0 ti\u1ec7n \u00edch m\u1edf r\u1ed9ng Elastic Stack k\u1ebft h\u1ee3p ho\u1eb7c \u0111\u00f3ng g\u00f3i c\u00e1c c\u1ea3nh b\u00e1o, b\u00e1o c\u00e1o, gi\u00e1m s\u00e1t, b\u1ea3o m\u1eadt v\u00e0 bi\u1ec3u \u0111\u1ed3 th\u00e0nh m\u1ed9t package duy nh\u1ea5t c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t nhanh ch\u00f3ng v\u00e0 d\u1ec5 d\u00e0ng.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">M\u1eb7c d\u00f9 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ee7a X-Pack ho\u1ea1t \u0111\u1ed9ng li\u1ec1n m\u1ea1ch v\u1edbi nhau, nh\u01b0ng b\u1ea1n c\u00f3 th\u1ec3 b\u1eadt ho\u1eb7c t\u1eaft c\u00e1c t\u00ednh n\u0103ng b\u1ea1n c\u1ea7n. V\u00ec X-Pack l\u00e0 ti\u1ec7n \u00edch m\u1edf r\u1ed9ng Elastic Stack, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t c\u1ea3 Elasticsearch v\u00e0 Kibana tr\u01b0\u1edbc khi c\u00e0i \u0111\u1eb7t X-Pack. Phi\u00ean b\u1ea3n X-Pack ph\u1ea3i kh\u1edbp v\u1edbi phi\u00ean b\u1ea3n Elasticsearch v\u00e0 Kibana.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Sau \u0111\u00e2y l\u00e0 m\u1ed9t s\u1ed1 l\u1ec7nh X-Pack c\u00f3 th\u1ec3 gi\u00fap b\u1ea1n c\u1ea5u h\u00ecnh b\u1ea3o m\u1eadt v\u00e0 th\u1ef1c hi\u1ec7n c\u00e1c t\u00e1c v\u1ee5 kh\u00e1c:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-certgen<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-certutil<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-reset-password<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-setup-passwords<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-syskeygen<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">elasticsearch-users\u2026<\/span><\/li>\n<\/ul>\n<h3><b>Bulk API trong Elasticsearch l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Bulk API trong Elasticsearch t\u1ea1o \u0111i\u1ec1u ki\u1ec7n cho vi\u1ec7c l\u1eadp index ho\u1eb7c x\u00f3a nhi\u1ec1u t\u00e0i li\u1ec7u trong m\u1ed9t y\u00eau c\u1ea7u duy nh\u1ea5t, n\u00e2ng cao hi\u1ec7u su\u1ea5t v\u00e0 hi\u1ec7u qu\u1ea3. Bulk API \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng r\u1ed9ng r\u00e3i \u0111\u1ec3 thu th\u1eadp v\u00e0 c\u1eadp nh\u1eadt d\u1eef li\u1ec7u quy m\u00f4 l\u1edbn trong Elasticsearch.<\/span><\/p>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 th\u00eam synonym v\u00e0o t\u00ecm ki\u1ebfm v\u0103n b\u1ea3n trong Elasticsearch?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">T\u1ea1o tr\u00ecnh analyzer t\u00f9y ch\u1ec9nh c\u00f3 synonym filter:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/my_index<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"settings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"analysis\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"filter\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"synonym_filter\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"synonym\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"synonyms\": [<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"big, large\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"small, tiny\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"synonym_analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"tokenizer\": \"standard\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"filter\": [\"lowercase\", \"synonym_filter\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"mappings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"properties\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"name\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"text\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"analyzer\": \"synonym_analyzer\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> Tri\u1ec3n khai t\u00ednh n\u0103ng t\u00ecm ki\u1ebfm b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng tr\u00ecnh ph\u00e2n t\u00edch <\/b><b>edge_ngram<\/b><b> nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">T\u1ea1o m\u1ed9t analyzer t\u00f9y ch\u1ec9nh v\u00e0 \u00e1p d\u1ee5ng n\u00f3 v\u00e0o tr\u01b0\u1eddng mapping:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/my_index<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"settings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"analysis\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"tokenizer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"edge_ngram_tokenizer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"edge_ngram\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"min_gram\": 1,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"max_gram\": 10,<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"token_chars\": [\"letter\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"search_completion_analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"custom\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"tokenizer\": \"edge_ngram_tokenizer\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"filter\": [\"lowercase\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"mappings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"properties\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"name\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"text\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"analyzer\": \"search_completion_analyzer\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"search_analyzer\": \"standard\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> L\u1eadp index 1 t\u00e0i li\u1ec7u b\u1eb1ng c\u00e1ch x\u00e1c \u0111\u1ecbnh pipeline trong qu\u00e1 tr\u00ecnh thu th\u1eadp nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng ph\u00e1p API \u201cPUT\u201d \u0111\u1ec3 t\u1ea1o pipeline v\u00e0 API l\u1eadp index \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh pipeline trong qu\u00e1 tr\u00ecnh thu th\u1eadp:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT _ingest\/pipeline\/custom_pipeline<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"description\": \"Custom pipeline\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"processors\": [<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0{ \"set\": { \"field\": \"new_field\", \"value\": \"new_value\" } }<\/span>\n<span style=\"font-weight: 400;\"> \u00a0]<\/span>\n<span style=\"font-weight: 400;\">}<\/span>\n<span style=\"font-weight: 400;\">POST _reindex<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"source\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"index\": \"source_index\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0},<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"dest\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"index\": \"destination_index\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"pipeline\": \"custom_pipeline\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 t\u1ea1o tr\u00ecnh ph\u00e2n t\u00edch t\u00f9y ch\u1ec9nh?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u1ea1o tr\u00ecnh ph\u00e2n t\u00edch t\u00f9y ch\u1ec9nh b\u1eb1ng ph\u01b0\u01a1ng ph\u00e1p API PUT, ph\u00e2n t\u00edch v\u00e0 ch\u1ec9 \u0111\u1ecbnh c\u1ea5u h\u00ecnh tokenizer, filter v\u00e0 char_filter.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">PUT \/my_index<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"settings\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"analysis\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"custom_analyzer\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"custom\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"tokenizer\": \"standard\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"filter\": [\"lowercase\", \"asciifolding\"],<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"char_filter\": [\"html_strip\"]<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><b> Th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm theo ph\u1ea1m vi ng\u00e0y trong Elasticsearch b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng Query DSL nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 th\u1ef1c hi\u1ec7n t\u00ecm ki\u1ebfm theo ph\u1ea1m vi ng\u00e0y trong Elasticsearch b\u1eb1ng Query DSL, b\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng lo\u1ea1i truy v\u1ea5n ph\u1ea1m vi.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">GET \/my_index\/_search<\/span>\n<span style=\"font-weight: 400;\">{<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\"query\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\"range\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\"@timestamp\": {<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"gte\": \"now-7d\/d\",<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"lt\": \"now\/d\"<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Elasticsearch h\u1ed7 tr\u1ee3 nhi\u1ec1u \u0111\u1ecbnh d\u1ea1ng ng\u00e0y v\u00e0 bi\u1ec3u th\u1ee9c ng\u00e0y t\u01b0\u01a1ng \u0111\u1ed1i:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8216;now&#8217;<\/span><span style=\"font-weight: 400;\">: Th\u1eddi gian hi\u1ec7n t\u1ea1i<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8216;now-1h&#8217;<\/span><span style=\"font-weight: 400;\">: 1 gi\u1edd tr\u01b0\u1edbc<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8216;now-1d\/d&#8217;<\/span><span style=\"font-weight: 400;\">: \u0110\u1ea7u ng\u00e0y c\u1ee7a ng\u00e0y h\u00f4m qua<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8216;now\/w&#8217;<\/span><span style=\"font-weight: 400;\">: \u0110\u1ea7u tu\u1ea7n hi\u1ec7n t\u1ea1i<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8216;2023-01-01||+1M&#8217;<\/span><span style=\"font-weight: 400;\">: Ng\u00e0y 01\/02\/2023 (1 th\u00e1ng sau 01\/01\/2023)<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket_cau_hoi_phong_van_Elasticsearch\"><\/span><b>T\u1ed5ng k\u1ebft c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">N\u1eafm v\u1eefng nh\u1eefng c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch v\u1eeba \u0111\u01b0\u1ee3c chia s\u1ebb trong b\u00e0i vi\u1ebft n\u00e0y s\u1ebd gi\u00fap \u1ee9ng vi\u00ean t\u1ef1 tin h\u01a1n trong qu\u00e1 tr\u00ecnh ph\u1ecfng v\u1ea5n v\u00e0 ch\u1ee9ng minh \u0111\u01b0\u1ee3c n\u0103ng l\u1ef1c c\u1ee7a m\u00ecnh. Hi v\u1ecdng r\u1eb1ng v\u1edbi s\u1ef1 chu\u1ea9n b\u1ecb k\u1ef9 l\u01b0\u1ee1ng, b\u1ea1n s\u1ebd th\u00e0nh c\u00f4ng chinh ph\u1ee5c v\u1ecb tr\u00ed mong mu\u1ed1n.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>B\u1ea1n \u0111ang chu\u1ea9n b\u1ecb \u1ee9ng tuy\u1ec3n m\u1ed9t v\u1ecb tr\u00ed y\u00eau c\u1ea7u ki\u1ebfn th\u1ee9c v\u1ec1 Elasticsearch? B\u00e0i vi\u1ebft n\u00e0y ch\u00ednh l\u00e0 \u201ctuy\u1ec7t chi\u00eau\u201d chinh ph\u1ee5c nh\u00e0 tuy\u1ec3n d\u1ee5ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9. T\u1eeb nh\u1eefng ki\u1ebfn th\u1ee9c n\u1ec1n t\u1ea3ng \u0111\u1ebfn k\u1ef9 n\u0103ng x\u1eed l\u00fd truy v\u1ea5n ph\u1ee9c t\u1ea1p, ITviec s\u1ebd [&hellip;]<\/p>\n","protected":false},"author":205,"featured_media":87356,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109,105],"tags":[],"class_list":["post-86059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it","category-phong-van-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9 - ITviec Blog<\/title>\n<meta name=\"description\" content=\"T\u0103ng c\u01a1 h\u1ed9i ph\u1ecfng v\u1ea5n th\u00e0nh c\u00f4ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao, k\u00e8m v\u00ed d\u1ee5 m\u00e3 c\u1ee5 th\u1ec3, d\u1ec5 hi\u1ec3u.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9\" \/>\n<meta property=\"og:description\" content=\"B\u1ea1n \u0111ang chu\u1ea9n b\u1ecb \u1ee9ng tuy\u1ec3n m\u1ed9t v\u1ecb tr\u00ed y\u00eau c\u1ea7u ki\u1ebfn th\u1ee9c v\u1ec1 Elasticsearch? B\u00e0i vi\u1ebft n\u00e0y ch\u00ednh l\u00e0 \u201ctuy\u1ec7t chi\u00eau\u201d chinh ph\u1ee5c nh\u00e0 tuy\u1ec3n d\u1ee5ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-22T02:31:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-17T08:00:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"337\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"H\u00e0 My\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"H\u00e0 My\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9 - ITviec Blog","description":"T\u0103ng c\u01a1 h\u1ed9i ph\u1ecfng v\u1ea5n th\u00e0nh c\u00f4ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao, k\u00e8m v\u00ed d\u1ee5 m\u00e3 c\u1ee5 th\u1ec3, d\u1ec5 hi\u1ec3u.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/","og_locale":"vi_VN","og_type":"article","og_title":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9","og_description":"B\u1ea1n \u0111ang chu\u1ea9n b\u1ecb \u1ee9ng tuy\u1ec3n m\u1ed9t v\u1ecb tr\u00ed y\u00eau c\u1ea7u ki\u1ebfn th\u1ee9c v\u1ec1 Elasticsearch? B\u00e0i vi\u1ebft n\u00e0y ch\u00ednh l\u00e0 \u201ctuy\u1ec7t chi\u00eau\u201d chinh ph\u1ee5c nh\u00e0 tuy\u1ec3n d\u1ee5ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi","og_url":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2025-04-22T02:31:08+00:00","article_modified_time":"2025-06-17T08:00:08+00:00","og_image":[{"width":640,"height":337,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png","type":"image\/png"}],"author":"H\u00e0 My","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"H\u00e0 My","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"1 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/"},"author":{"name":"H\u00e0 My","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/7bd099db44e5079508c9b7e8c0161e3c"},"headline":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9","datePublished":"2025-04-22T02:31:08+00:00","dateModified":"2025-06-17T08:00:08+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/"},"wordCount":10852,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT","Ph\u1ecfng v\u1ea5n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/","url":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/","name":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9 - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png","datePublished":"2025-04-22T02:31:08+00:00","dateModified":"2025-06-17T08:00:08+00:00","description":"T\u0103ng c\u01a1 h\u1ed9i ph\u1ecfng v\u1ea5n th\u00e0nh c\u00f4ng v\u1edbi b\u1ed9 c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao, k\u00e8m v\u00ed d\u1ee5 m\u00e3 c\u1ee5 th\u1ec3, d\u1ec5 hi\u1ec3u.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/cau-hoi-phong-van-elasticsearch-vippro-scaled.png","width":640,"height":337,"caption":"c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n elasticsearch - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/cau-hoi-phong-van-elasticsearch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Top 45+ c\u00e2u h\u1ecfi ph\u1ecfng v\u1ea5n Elasticsearch theo t\u1eebng c\u1ea5p \u0111\u1ed9"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/7bd099db44e5079508c9b7e8c0161e3c","name":"H\u00e0 My","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ha-my-author-e1709882319892-100x100.jpeg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ha-my-author-e1709882319892-100x100.jpeg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/ha-my-author-e1709882319892-100x100.jpeg","caption":"H\u00e0 My"},"url":"https:\/\/itviec.com\/blog\/author\/ha-my\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/86059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/205"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=86059"}],"version-history":[{"count":1,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/86059\/revisions"}],"predecessor-version":[{"id":88192,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/86059\/revisions\/88192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/87356"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=86059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=86059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=86059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}