{"id":22687,"date":"2026-04-19T00:34:32","date_gmt":"2026-04-19T00:34:32","guid":{"rendered":"https:\/\/umang.pk\/2026\/04\/19\/elasticsearch-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-%d9%88%db%8c%d8%a8-%d8%a7%db%8c%d9%be%d9%84%db%8c%da%a9%db%8c%d8%b4%d9%86%d8%b2\/"},"modified":"2026-04-19T00:34:33","modified_gmt":"2026-04-19T00:34:33","slug":"elasticsearch-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-%d9%88%db%8c%d8%a8-%d8%a7%db%8c%d9%be%d9%84%db%8c%da%a9%db%8c%d8%b4%d9%86%d8%b2","status":"publish","type":"post","link":"https:\/\/umang.pk\/en_us\/2026\/04\/19\/elasticsearch-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-%d9%88%db%8c%d8%a8-%d8%a7%db%8c%d9%be%d9%84%db%8c%da%a9%db%8c%d8%b4%d9%86%d8%b2\/","title":{"rendered":"Elasticsearch \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0648\u06cc\u0628 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646\u0632 \u0645\u06cc\u06ba \u062a\u0644\u0627\u0634 \u06a9\u0648 \u0622\u0633\u0627\u0646 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u0627 \u0637\u0631\u06cc\u0642\u06c1"},"content":{"rendered":"\n<div id=\"\">\n<p>\u0648\u06c1 \u06a9\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0688\u06cc\u0679\u0627 \u0646\u06cc\u0627 \u0633\u0648\u0646\u0627 \u06c1\u06d2\u06d4 \u062a\u0627\u06c1\u0645\u060c \u0631\u06cc\u06a9\u0627\u0631\u0688 \u0648\u0642\u062a \u0645\u06cc\u06ba \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06d2 \u0645\u0637\u0627\u0644\u0628\u0627\u062a \u06a9\u0648 \u067e\u0648\u0631\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u0691\u06d2 \u0688\u06cc\u0679\u0627 \u0633\u06cc\u0679\u0633 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0688\u0648\u06cc\u0644\u067e\u0631\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0631\u062f \u0633\u0631 \u0628\u0646\u06cc \u06c1\u0648\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0631\u0648\u0627\u06cc\u062a\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06d2 \u0633\u0648\u0627\u0644\u0627\u062a \u0627\u06a9\u062b\u0631 \u062f\u0631\u0633\u062a \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0646\u062a\u0627\u0626\u062c \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0644\u06cc\u06a9\u0646 \u062e\u0648\u0634 \u0642\u0633\u0645\u062a\u06cc \u0633\u06d2\u060c Elasticsearch \u0645\u062f\u062f \u06a9\u06d2 \u0644\u06cc\u06d2 \u062d\u0627\u0636\u0631 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633 \u0645\u0636\u0645\u0648\u0646 \u0645\u06cc\u06ba\u060c \u0645\u06cc\u06ba \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u0624\u06ba \u06af\u0627 \u06a9\u06c1 \u06a9\u0627\u0631\u06a9\u0631\u062f\u06af\u06cc \u06a9\u0648 \u0628\u0631\u0642\u0631\u0627\u0631 \u0631\u06a9\u06be\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u0627\u0648\u0631 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0648 \u0628\u06c1\u062a\u0631 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 Elasticsearch \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4<\/p>\n<p>\u0627\u0633 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0636\u0631\u0648\u0631\u06cc \u0634\u0631\u0627\u0626\u0637 \u06c1\u06cc\u06ba:<\/p>\n<ul>\n<li>\n<p>Node.js \u0645\u0627\u062d\u0648\u0644<\/p>\n<\/li>\n<li>\n<p>\u0628\u0646\u06cc\u0627\u062f\u06cc \u067e\u0633\u062f\u06cc\u062f \u0639\u0644\u0645<\/p>\n<\/li>\n<\/ul>\n<p>\u0627\u0628 \u0622\u0626\u06cc\u06d2 \u0634\u0631\u0648\u0639 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0644\u06cc\u06a9\u0646 \u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c Elasticsearch \u06a9\u06cc\u0627 \u06c1\u06d2\u061f<\/p>\n<h3 id=\"heading-table-of-content\">\u0627\u0646\u0688\u06cc\u06a9\u0633<\/h3>\n<h2 id=\"heading-what-is-elasticsearch\">Elasticsearch \u06a9\u06cc\u0627 \u06c1\u06d2\u061f<\/h2>\n<p>Elasticsearch \u0627\u06cc\u06a9 \u0633\u0631\u0686 \u0627\u0646\u062c\u0646 \u06c1\u06d2 \u062c\u0648 Apache \u067e\u0631 \u0628\u0646\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2 \u062c\u0648 \u0627\u0644\u0641\u0627\u0638 \u0627\u0648\u0631 \u0641\u0642\u0631\u0648\u06ba \u06a9\u0648 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u06a9\u06d2 \u0627\u06cc\u0688\u0648\u0627\u0646\u0633 \u0679\u06cc\u06a9\u0633\u0679 \u0627\u0648\u0631 \u0648\u06cc\u06a9\u0679\u0631 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0635\u0644\u0627\u062d\u06cc\u062a \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u0645\u06cc\u06ba \u062f\u06cc\u06af\u0631 \u0645\u0641\u06cc\u062f \u062e\u0635\u0648\u0635\u06cc\u0627\u062a \u0628\u06be\u06cc \u06c1\u06cc\u06ba \u062c\u06cc\u0633\u06d2 \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u062a\u062c\u0632\u06cc\u0627\u062a \u0627\u0648\u0631 \u062e\u0648\u062f\u06a9\u0627\u0631 \u062a\u06a9\u0645\u06cc\u0644 \u062e\u0635\u0648\u0635\u06cc\u0627\u062a\u06d4<\/p>\n<p>Elasticsearch \u0627\u0634\u0627\u0631\u06cc\u06c1 \u0633\u0627\u0632\u06cc \u06a9\u06cc \u0635\u0644\u0627\u062d\u06cc\u062a\u06cc\u06ba \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 (\u0645\u0642\u0628\u0648\u0644 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0628\u06be\u06cc \u0627\u0633\u06d2 \u067e\u06cc\u0634 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba)\u060c \u0644\u06cc\u06a9\u0646 \u06cc\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<p>\u067e\u06cc\u062f\u0627\u0648\u0627\u0631\u06cc \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0627\u0633 \u0679\u0648\u0644 \u06a9\u06d2 \u062f\u0648\u0633\u0631\u06d2 \u0645\u0642\u0628\u0648\u0644 \u0645\u062a\u0628\u0627\u062f\u0644 \u0645\u06cc\u06ba Algolia\u060c OpenSearch\u060c \u0627\u0648\u0631 MeiliSearch \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-elasticsearch-key-terms\">Elasticsearch \u06a9\u0644\u06cc\u062f\u06cc \u0634\u0631\u0627\u0626\u0637<\/h2>\n<p>\u0627\u0633 \u0633\u06cc\u06a9\u0634\u0646 \u0645\u06cc\u06ba\u060c \u06c1\u0645 Elasticsearch \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06cc \u06a9\u0686\u06be \u0627\u06c1\u0645 \u0627\u0635\u0637\u0644\u0627\u062d\u0627\u062a \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2\u06d4 \u0622\u067e \u06a9\u0648 \u0633\u0645\u062c\u06be\u0646\u06d2 \u0645\u06cc\u06ba \u0645\u062f\u062f \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u06c1\u0645 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u06a9\u0686\u06be \u0639\u0627\u0645 \u0627\u0635\u0637\u0644\u0627\u062d\u0627\u062a \u06a9\u0627 \u062d\u0648\u0627\u0644\u06c1 \u062f\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<ul>\n<li>\n<p><strong>\u0627\u0646\u0688\u06cc\u06a9\u0633<\/strong>: \u0622\u067e \u062c\u0633 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u062f\u0631\u06cc\u0627\u0641\u062a \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0633\u06d2 \u0630\u062e\u06cc\u0631\u06c1 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u062c\u06af\u06c1 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 Elasticsearch \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u0637\u0631\u062d \u06c1\u06d2\u06d4 DBs \u062f\u06cc\u06af\u0631 \u062e\u0635\u0648\u0635\u06cc\u0627\u062a \u0628\u06be\u06cc \u0634\u06cc\u0626\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u06cc\u0633\u06d2 \u0627\u0646\u0641\u0631\u0627\u062f\u06cc\u062a\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u062f\u0633\u062a\u0627\u0648\u06cc\u0632:<\/strong> \u06cc\u06c1 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u0630\u062e\u06cc\u0631\u06c1 \u0634\u062f\u06c1 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u06a9\u06cc \u0633\u0628 \u0633\u06d2 \u0686\u06be\u0648\u0679\u06cc \u0627\u06a9\u0627\u0626\u06cc \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0633\u0627\u062e\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 MongoDB \u067e\u0631 \u0645\u0628\u0646\u06cc \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u0633\u06d2 \u0645\u0645\u0627\u062b\u0644 \u06c1\u06d2 \u0627\u0648\u0631 SQL \u067e\u0631 \u0645\u0628\u0646\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0645\u06cc\u06ba \u0642\u0637\u0627\u0631 \u06a9\u06cc \u0637\u0631\u062d \u0628\u06be\u06cc \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0646\u0642\u0634\u06c1 \u0633\u0627\u0632\u06cc:<\/strong> \u0627\u06cc\u06a9 \u0645\u06cc\u067e\u0646\u06af \u0642\u0648\u0627\u0639\u062f \u06cc\u0627 \u0631\u06c1\u0646\u0645\u0627 \u062e\u0637\u0648\u0637 \u06a9\u06d2 \u0627\u06cc\u06a9 \u0633\u06cc\u0679 \u06a9\u06cc \u0646\u0645\u0627\u0626\u0646\u062f\u06af\u06cc \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u062c\u0648 \u0627\u0633 \u0628\u0627\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u06a9\u06c1 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632\u0627\u062a \u0627\u0648\u0631 \u0641\u06cc\u0644\u0688\u0632 \u06a9\u0648 Elasticsearch \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u06a9\u06cc\u0633\u06d2 \u0630\u062e\u06cc\u0631\u06c1 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0633\u06a9\u0648\u0631:<\/strong> \u06cc\u06c1 Elasticsearch \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06c1 \u0628\u0646\u0627\u0626\u06d2 \u06af\u0626\u06d2 \u06c1\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u0630\u062e\u06cc\u0631\u06c1 \u0634\u062f\u06c1 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u06a9\u06cc \u0645\u0637\u0627\u0628\u0642\u062a \u06a9\u06cc \u0688\u06af\u0631\u06cc \u06a9\u06cc \u0646\u0634\u0627\u0646\u062f\u06c1\u06cc \u06a9\u06cc \u062c\u0627\u0633\u06a9\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631:<\/strong> \u062c\u0628 \u0688\u06cc\u0679\u0627 \u0627\u0634\u0627\u0631\u06cc\u06c1 \u0633\u0627\u0632\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 Elasticsearch \u0627\u0646\u062c\u0646 \u06a9\u0648 \u0628\u06be\u06cc\u062c\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u06cc\u06c1 \u0627\u0628\u062a\u062f\u0627\u0626\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0627\u06cc\u06a9 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631 \u0633\u06d2 \u06af\u0632\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0627\u0634\u0627\u0631\u06cc\u06c1 \u0633\u0627\u0632\u06cc \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0645\u062a\u0646 \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0641\u0644\u0679\u0631\u0632 \u0627\u0648\u0631 \u0679\u0648\u06a9\u0646\u0627\u0626\u0632\u0631\u0632 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u062d\u0627\u0635\u0644 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0679\u0648\u06a9\u0646\u0627\u0626\u0632\u0631:<\/strong> \u06cc\u06c1 \u0679\u0648\u0644 Elasticsearch \u0627\u0646\u062c\u0646 \u06a9\u0648 \u0628\u06be\u06cc\u062c\u06d2 \u06af\u0626\u06d2 \u067e\u0648\u0631\u06d2 \u063a\u06cc\u0631 \u0633\u0627\u062e\u062a\u06c1 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0645\u0632\u06cc\u062f \u067e\u0631\u0648\u0633\u06cc\u0633\u0646\u06af \u0627\u0648\u0631 \u0627\u0633\u0679\u0648\u0631\u06cc\u062c \u06a9\u06d2 \u0644\u06cc\u06d2 \u0633\u0679\u0631\u06a9\u0686\u0631\u0688 \u0688\u06cc\u0679\u0627 \u0679\u0648\u06a9\u0646 \u0645\u06cc\u06ba \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u062c\u0645\u0639 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u0627:<\/strong> \u06cc\u06c1 \u0633\u0631\u0686 \u0679\u0648\u0644 \u0642\u0627\u0628\u0644 \u0639\u0645\u0644 \u0688\u06cc\u0679\u0627 \u0628\u0635\u06cc\u0631\u062a \u067e\u06cc\u062f\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u0630\u062e\u06cc\u0631\u06c1 \u0634\u062f\u06c1 \u0679\u0648\u06a9\u0646\u0632 \u06a9\u0627 \u062a\u0641\u0635\u06cc\u0644\u06cc \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 Elasticsearch \u0627\u0646\u062c\u0646 \u06a9\u0627 \u0641\u0627\u0626\u062f\u06c1 \u06c1\u06d2\u06d4 Mongo DB \u06a9\u0627 \u06a9\u0644\u06a9\u0679\u0631 \u0627\u0633\u06cc \u0637\u0631\u062d \u06a9\u06cc \u0641\u0639\u0627\u0644\u06cc\u062a \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0641\u0644\u0679\u0631<\/strong>: \u06a9\u0645\u0627\u0646\u0688\u0632 \u06a9\u0627 \u0627\u06cc\u06a9 \u0645\u062c\u0645\u0648\u0639\u06c1 \u062c\u0648 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u06d2 \u0639\u0645\u0644 \u06a9\u06d2 \u062f\u0648\u0631\u0627\u0646 \u067e\u06cc\u062f\u0627 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0679\u0648\u06a9\u0646\u0632 \u0645\u06cc\u06ba \u062a\u0631\u0645\u06cc\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u06d2 \u0646\u062a\u06cc\u062c\u06d2 \u0645\u06cc\u06ba \u0641\u0644\u0631\u0632\u060c \u06a9\u06cc\u067e\u0679\u0644\u0627\u0626\u0632\u06cc\u0634\u0646 \u0631\u0648\u0644\u0632 \u0648\u063a\u06cc\u0631\u06c1 \u06a9\u0648 \u06c1\u0679\u0627\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0628\u0644\u06a9 \u0627\u0646\u0688\u06cc\u06a9\u0633:<\/strong> \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0648\u0642\u062a \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632\u0627\u062a \u06a9\u0648 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u0646\u0627\u06d4 \u0622\u067e \u0639\u0627\u0645 \u0637\u0648\u0631 \u067e\u0631 \u06cc\u06c1 \u0627\u0633 \u0648\u0642\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0628 \u0645\u0648\u062c\u0648\u062f\u06c1 \u0645\u0648\u0627\u062f \u067e\u0631 \u0645\u0634\u062a\u0645\u0644 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0648 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<\/ul>\n<h2 id=\"heading-how-to-set-up-elasticsearch\">Elasticsearch \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4<\/h2>\n<p>\u0627\u0633 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u06c1\u0645 \u0622\u067e \u06a9\u06d2 \u0645\u0642\u0627\u0645\u06cc \u06a9\u0645\u067e\u06cc\u0648\u0679\u0631 \u067e\u0631 Elasticsearch \u06a9\u0627 \u0627\u0646\u0633\u0679\u0627\u0644\u06cc\u0628\u0644 \u0633\u0627\u0641\u0679 \u0648\u06cc\u0626\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba \u06af\u06d2\u06d4 Elasticsearch \u06a9\u0627 \u0627\u06cc\u06a9 \u0622\u0646 \u0644\u0627\u0626\u0646 \u0645\u06cc\u0632\u0628\u0627\u0646 \u0648\u0631\u0698\u0646 \u0628\u06be\u06cc \u06c1\u06d2 \u062c\u0648 \u0628\u06d2 \u0639\u06cc\u0628 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1\u0627\u06ba \u0627\u06cc\u06a9 \u0644\u0646\u06a9 \u06c1\u06d2 \u062c\u0633 \u0645\u06cc\u06ba \u0628\u062a\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0648\u0646\u0688\u0648\u0632 \u067e\u0631 Elasticsearch \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4 \u063a\u06cc\u0631 \u0648\u0646\u0688\u0648\u0632 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e Linux\/Mac OS \u067e\u0631 Elasticsearch \u06a9\u0648 \u0628\u06be\u06cc \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06cc\u0627 Docker \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0645\u06cc\u0645\u0648<\/strong> \u0648\u0646\u0688\u0648\u0632 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u0627\u0646\u0633\u0679\u0627\u0644\u06cc\u0634\u0646 \u06a9\u06cc \u063a\u0644\u0637\u06cc\u0648\u06ba \u0633\u06d2 \u0628\u0686\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 Elasticsearch \u06a9\u0648 \u0686\u0644\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<p>\u06a9\u0627\u0645\u06cc\u0627\u0628 \u062a\u0646\u0635\u06cc\u0628 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0622\u067e \u062c\u0627\u0646\u0686 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0622\u06cc\u0627 \u06cc\u06c1 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2: <code>localhost:9200<\/code> \u06cc\u06c1 Elasticsearch \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0637\u06d2 \u0634\u062f\u06c1 \u0645\u0642\u0627\u0645\u06cc \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0646\u06cc\u0686\u06d2 \u062f\u06cc \u06af\u0626\u06cc \u062a\u0635\u0648\u06cc\u0631 \u06a9\u06cc \u0637\u0631\u062d \u06a9\u0627\u0645\u06cc\u0627\u0628\u06cc \u06a9\u0627 \u067e\u06cc\u063a\u0627\u0645 \u0622\u067e \u06a9\u06cc \u0633\u06a9\u0631\u06cc\u0646 \u067e\u0631 \u0638\u0627\u06c1\u0631 \u06c1\u0648\u06af\u0627\u06d4<\/p>\n<p>\u06cc\u06c1 \u06c1\u0645\u06cc\u06ba \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u0648 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u06d2 \u0627\u0648\u0631 ElasticSearch \u06a9\u0648 \u0688\u06cc\u0645\u0648 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0645\u06cc\u06ba \u0636\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0627\u0642\u062f\u0627\u0645\u0627\u062a \u0633\u06d2 \u06af\u0632\u0631\u06d2 \u06af\u0627\u06d4<\/p>\n<h2 id=\"heading-how-to-set-up-the-demo-project\">\u0688\u06cc\u0645\u0648 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u06cc\u0633\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4<\/h2>\n<p>\u0627\u0633 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u0645\u06cc\u06ba\u060c \u06c1\u0645 \u0646\u0648\u0688 \u0627\u06cc\u06a9\u0633\u067e\u0631\u06cc\u0633 \u062c\u06d2 \u0627\u06cc\u0633 \u067e\u0631 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u062a\u0639\u0645\u06cc\u0631 \u0634\u062f\u06c1 \u0641\u0648\u0631\u0645 \u067e\u0631 \u0645\u0628\u0646\u06cc \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u0627 \u0641\u0627\u0626\u062f\u06c1 \u0627\u0679\u06be\u0627\u0626\u06cc\u06ba \u06af\u06d2\u06d4 \u06cc\u06c1\u0627\u06ba \u067e\u0631\u0627\u062c\u06cc\u06a9\u0679 \u06a9\u0627 \u0644\u0646\u06a9 \u06c1\u06d2:<\/p>\n<p>\u0627\u067e\u0646\u06d2 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u0648 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0627\u0648\u0631 \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0627\u0633 \u067e\u06cc\u06a9\u06cc\u062c \u06a9\u0648 \u06a9\u0644\u0648\u0646 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<p><code>npm start<\/code><\/p>\n<p><code>MySQL<\/code>    \u0627\u0633\u06d2 \u0627\u0633 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0688\u06cc\u0641\u0627\u0644\u0679 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u06af\u0627\u06d4 \u0627\u0628 \u0627\u06af\u0644\u06d2 \u062d\u0635\u06d2 \u06a9\u06cc \u0637\u0631\u0641 \u0686\u0644\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-how-to-set-up-elasticsearch-in-your-project\">\u0627\u067e\u0646\u06d2 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0645\u06cc\u06ba Elasticsearch \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4<\/h2>\n<p>\u0645\u0648\u062c\u0648\u062f\u06c1 \u0688\u06cc\u0645\u0648 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0627\u06cc\u06a9 \u0641\u0648\u0631\u0645 \u0633\u0627\u0626\u0679 \u06a9\u0627 \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u067e\u0631 \u0639\u0645\u0644 \u062f\u0631\u0622\u0645\u062f \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u0635\u0627\u0631\u0641 \u0679\u06cc\u06a9\u0633\u0679 \u0645\u0648\u0627\u062f \u067e\u0648\u0633\u0679 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0632\u0645\u0631\u06c1 \u067e\u0631 \u0645\u0628\u0646\u06cc \u062a\u06be\u0631\u06cc\u0688\u0632 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0628\u062d\u062b \u06a9\u0648 \u0641\u0631\u0648\u063a \u062f\u06d2 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>Elasticsearch \u0645\u0646\u0641\u0631\u062f \u0645\u0637\u0644\u0648\u0628\u06c1 \u0627\u0644\u0641\u0627\u0638 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u06a9\u0644\u06cc\u062f\u06cc \u0645\u0648\u0627\u062f \u06a9\u06cc \u0646\u0634\u0627\u0646\u062f\u06c1\u06cc \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0646 \u067e\u0648\u0633\u0679\u0633 \u0627\u0648\u0631 \u062a\u06be\u0631\u06cc\u0688\u0632 \u06a9\u0648 \u0686\u06be\u0627\u0646\u0646\u06d2 \u0645\u06cc\u06ba \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06cc \u0645\u062f\u062f \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0631\u0648\u0627\u06cc\u062a\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0633\u0648\u0627\u0644\u0627\u062a \u06a9\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0645\u0648\u062b\u0631 \u06c1\u06d2\u060c \u062c\u0648 \u06a9\u06c1 \u0628\u0648\u062c\u06be\u0644 \u06c1\u0648 \u0633\u06a9\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>Elasticsearch \u06a9\u0648 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u067e\u06c1\u0644\u06d2 Elasticsearch \u06a9\u0648 \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>npm<\/code> \u067e\u06cc\u06a9\u062c \u0627\u06cc\u0633\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0627\u067e\u0646\u06cc \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0688\u0627\u0626\u0631\u06a9\u0679\u0631\u06cc \u0633\u06d2 \u0646\u06cc\u0686\u06d2 \u062f\u06cc \u06af\u0626\u06cc \u06a9\u0645\u0627\u0646\u0688 \u06a9\u0648 \u0686\u0644\u0627\u0626\u06cc\u06ba:<\/p>\n<pre><code class=\"language-shell\">npm install @elastic\/elasticsearch\n<\/code><\/pre>\n<p>\u06a9\u0627\u0645\u06cc\u0627\u0628 \u062a\u0646\u0635\u06cc\u0628 \u06a9\u06d2 \u0628\u0639\u062f <code>config.js<\/code> \u06cc\u06c1 \u0648\u06c1 \u0641\u0627\u0626\u0644 \u06c1\u06d2 \u062c\u0648 \u0688\u0631\u0627\u0626\u06cc\u0648\u0631 \u06a9\u0648 Elasticsearch \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u0633\u06d2 \u062c\u0691\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0633\u06cc\u0679 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">const { Client } = require('@elastic\/elasticsearch');\n\nconst esClient = new Client({\n  node: 'http:\/\/localhost:9200',\n  auth: {\n    username: process.env.ELASTICSEARCH_USERNAME,\n    password: process.env.ELASTICSEARCH_PASSWORD\n  },\n  maxRetries: 5,\n  requestTimeout: 60000,\n  tls: {\n    rejectUnauthorized: process.env.NODE_ENV !== 'development'\n  }\n});\n\nmodule.exports = esClient;\n<\/code><\/pre>\n<p>\u0627\u067e\u0646\u06cc \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u06d2 \u0627\u0646\u062f\u0631 Elasticsearch \u06a9\u06cc \u062e\u0635\u0648\u0635\u06cc\u0627\u062a \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u0627\u0648\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e \u06a9\u0648 Elasticsearch \u0688\u0631\u0627\u0626\u06cc\u0648\u0631 \u06a9\u0648 \u0633\u06cc\u0679 \u0627\u067e \u0627\u0648\u0631 \u06a9\u0646\u0641\u06cc\u06af\u0631 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u06d4 \u062a\u0641\u0635\u06cc\u0644\u0627\u062a \u0627\u0648\u067e\u0631 \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u0641\u0627\u0626\u0644 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u0628\u06cc\u0627\u0646 \u06a9\u06cc \u06af\u0626\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u062c\u06cc\u0633\u0627 \u06a9\u06c1 \u067e\u06c1\u0644\u06d2 \u0630\u06a9\u0631 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u060c Elasticsearch \u067e\u0631 \u0686\u0644\u062a\u0627 \u06c1\u06d2: <code>localhost:9200<\/code> \u0628\u0646\u062f\u0631\u06af\u0627\u06c1 \u0644\u06c1\u0630\u0627 Elasticsearch \u0646\u0648\u0688 \u0644\u0648\u06a9\u0644 \u06c1\u0648\u0633\u0679 \u067e\u0648\u0631\u0679 \u0633\u06d2 \u062c\u0691 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0622\u0646 \u0644\u0627\u0626\u0646 \u06c1\u0648\u0633\u0679 \u06a9\u0631\u062f\u06c1 Elasticsearch \u0646\u0648\u0688\u0633 \u0628\u06be\u06cc \u0627\u0633\u06cc \u0637\u0631\u062d \u06a9\u06d2 \u0645\u0646\u0638\u0631\u0646\u0627\u0645\u0648\u06ba \u0645\u06cc\u06ba \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0644\u0627\u060c \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba Elasticsearch \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0631\u06a9\u0627\u0631 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0627\u0633\u0646\u0627\u062f \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u06cc\u06ba\u06d4 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u062f\u06c1 \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u0627\u0648\u0631 \u067e\u0627\u0633 \u0648\u0631\u0688 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0622\u0628\u062c\u06cc\u06a9\u0679 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u06cc\u06d2 \u06af\u0626\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u0622\u067e \u0645\u0642\u0627\u0645\u06cc \u0637\u0648\u0631 \u067e\u0631 Elasticsearch \u0686\u0644\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u0648 \u0633\u06a9\u062a\u06cc \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u0641\u0639\u0627\u0644 \u0646\u06c1 \u06c1\u0648\u06d4<\/p>\n<p>\u0627\u0633 \u0645\u0646\u0638\u0631 \u0646\u0627\u0645\u06d2 \u0645\u06cc\u06ba <code>MaxRetries<\/code> Elasticsearch \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645 \u06a9\u0648\u0634\u0634\u0648\u06ba \u06a9\u06cc \u0632\u06cc\u0627\u062f\u06c1 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0639\u062f\u0627\u062f \u06a9\u06cc \u0646\u0634\u0627\u0646\u062f\u06c1\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u0645\u0639\u0627\u0645\u0644\u06d2 \u0645\u06cc\u06ba\u060c \u06c1\u0645 \u0646\u06d2 \u0627\u0633\u06d2 5 \u06a9\u0648\u0634\u0634\u0648\u06ba \u0645\u06cc\u06ba \u0679\u06be\u06cc\u06a9 \u06a9\u06cc\u0627\u06d4 <code>requestTimeout<\/code> \u0645\u0644\u06cc \u0633\u06cc\u06a9\u0646\u0688\u0632 \u06a9\u06cc \u062a\u0639\u062f\u0627\u062f \u062c\u0633 \u06a9\u06d2 \u0628\u0639\u062f \u06a9\u0648\u0626\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u0646\u06c1 \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u0635\u0648\u0631\u062a \u0645\u06cc\u06ba \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u062e\u062a\u0645 \u06c1\u0648 \u062c\u0627\u0626\u06d2 \u06af\u06cc\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u0622\u067e \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u0641\u0627\u0626\u0644 \u0645\u06a9\u0645\u0644 \u06a9\u0631 \u0644\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u06c1\u0645 \u0627\u0633 \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u06a9\u0648 \u062f\u0631\u0622\u0645\u062f \u06a9\u0631\u06cc\u06ba \u06af\u06d2 \u0627\u0648\u0631 \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0634\u0631\u0648\u0639 \u06c1\u0648\u0646\u06d2 \u067e\u0631 Elasticsearch \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u0648 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<h2 id=\"heading-how-to-work-with-indexes-in-elasticsearch\">Elasticsearch \u0645\u06cc\u06ba \u0627\u0634\u0627\u0631\u06cc\u06c1 \u062c\u0627\u062a \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633\u06d2 \u06a9\u0631\u06cc\u06ba\u06d4<\/h2>\n<p>\u0627\u0633 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06a9\u06c1 \u0622\u067e Elasticsearch \u06a9\u06cc \u067e\u0648\u0631\u06cc \u0637\u0627\u0642\u062a \u0633\u06d2 \u0641\u0627\u0626\u062f\u06c1 \u0627\u0679\u06be\u0627 \u0633\u06a9\u06cc\u06ba\u060c \u0622\u067e \u06a9\u0648 \u0627\u067e\u0646\u06d2 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u06d2 \u067e\u0633\u062f\u06cc\u062f \u0645\u06cc\u06ba \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0641\u0639\u0627\u0644\u06cc\u062a \u06a9\u0648 \u062d\u0633\u0628 \u0636\u0631\u0648\u0631\u062a \u0628\u0646\u0627\u0646\u0627 \u06c1\u0648\u06af\u0627\u06d4 \u0627\u0633 \u0645\u06cc\u06ba Elasticsearch Engine \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u0627\u06cc\u06a9 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u0627 \u0634\u0627\u0645\u0644 \u06c1\u06d2 \u062c\u0648 \u0622\u067e \u06a9\u06cc \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u067e\u0631 \u0644\u06a9\u06be\u06cc \u06af\u0626\u06cc \u062a\u0645\u0627\u0645 \u067e\u0648\u0633\u0679\u0633 \u06a9\u0648 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">const esClient = require('.\/config');\n\nconst setupIndex = async () => {\n  try {\n    const indexExists = await esClient.indices.exists({\n      index: INDEX_NAME\n    });\n\n    if (indexExists) {\n      console.log(`Index \"${INDEX_NAME}\" already exists`);\n      return;\n    }\n\n    await esClient.indices.create({\n      index: INDEX_NAME,\n      ...indexMapping\n    });\n\n    console.log(`Index \"${INDEX_NAME}\" created`);\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<p>\u0627\u0648\u067e\u0631 \u06a9\u0627 \u06a9\u0648\u0688 \u0627\u06cc\u06a9 \u0646\u0626\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u06cc \u062a\u062e\u0644\u06cc\u0642 \u067e\u0631 \u0631\u0648\u0634\u0646\u06cc \u0688\u0627\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 <code>setupIndex()<\/code> \u0641\u0646\u06a9\u0634\u0646 \u0627\u0633 \u0641\u0646\u06a9\u0634\u0646 \u06a9\u06d2 \u0627\u0646\u062f\u0631\u060c \u0622\u067e \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u062a\u0631\u062c\u06cc\u062d\u06cc \u0646\u0627\u0645 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 Elasticsearch \u067e\u06be\u0631 \u06cc\u06c1 \u062f\u06cc\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0686\u06cc\u06a9 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0622\u06cc\u0627 \u0648\u06c1 \u0646\u0627\u0645 \u0627\u0633 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0627 \u0646\u0627\u0645 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2 \u062a\u0648 \u0641\u0646\u06a9\u0634\u0646 \u062e\u062a\u0645 \u06c1\u0648 \u062c\u0627\u062a\u0627 \u06c1\u06d2 (\u0646\u0642\u0644 \u0633\u06d2 \u0628\u0686\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2)\u06d4 \u062a\u0627\u06c1\u0645\u060c \u0627\u06af\u0631 \u06cc\u06c1 \u0645\u0648\u062c\u0648\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u062a\u0648 \u06cc\u06c1 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u067e\u0646\u06af \u06a9\u06d2 \u0642\u0648\u0627\u0639\u062f \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u067e\u0646\u06d2 \u0645\u0646\u0641\u0631\u062f \u0646\u0627\u0645 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0628\u0646\u0627\u0626\u06d2 \u06af\u0627 (\u0627\u0633 \u067e\u0631 \u062c\u0644\u062f \u06c1\u06cc \u0645\u0632\u06cc\u062f)\u06d4<\/p>\n<p>\u0627\u0646\u0688\u06cc\u06a9\u0633 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0622\u067e \u06a9\u0648 \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646 \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba \u06a9\u0627\u0645\u06cc\u0627\u0628\u06cc \u06a9\u0627 \u067e\u06cc\u063a\u0627\u0645 \u0646\u0638\u0631 \u0622\u0626\u06d2 \u06af\u0627\u06d4<\/p>\n<h3 id=\"heading-how-to-delete-an-index\">\u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u062a\u06be\u0648\u0691\u06cc \u062f\u06cc\u0631 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0627\u06cc\u06a9 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0627\u067e\u0646\u0627 \u0645\u0642\u0635\u062f \u067e\u0648\u0631\u0627 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u0627\u0648\u0631 \u0622\u067e \u06a9\u0648 \u0627\u0633\u06d2 Elasticsearch \u0633\u06d2 \u06c1\u0679\u0627\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u067e\u0691 \u0633\u06a9\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0622\u067e \u0627\u0633\u06d2 \u0686\u0644\u0627 \u06a9\u0631 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba: <code>esClient.indices.delete()<\/code> \u0630\u06cc\u0644 \u0645\u06cc\u06ba \u06a9\u0645\u0627\u0646\u0688 \u062c\u0627\u0631\u06cc \u06a9\u0631\u06cc\u06ba:<\/p>\n<pre><code class=\"language-javascript\">const deleteIndex = async () => {\n  try {\n    await esClient.indices.delete({ index: INDEX_NAME });\n    console.log(`${INDEX_NAME} deleted`);\n  } catch (err) {\n    console.error(\"Error deleting index:\", err);\n  }\n};\n<\/code><\/pre>\n<h3 id=\"heading-how-to-delete-a-post-within-an-index\">\u0627\u067e\u0646\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u067e\u0648\u0633\u0679 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u06a9\u0628\u06be\u06cc \u06a9\u0628\u06be\u0627\u0631 \u067e\u0648\u0633\u0679\u0633 \u06a9\u0648 \u0688\u06cc\u0644\u06cc\u0679 \u06cc\u0627 \u0627\u06cc\u0688\u0679 \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u0628\u0644\u0627\u06a9 \u0628\u06be\u06cc \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u060c \u062c\u0633 \u06a9\u06d2 \u0628\u0639\u062f \u0627\u0646 \u06a9\u06d2 \u0645\u0648\u0627\u062f \u06a9\u0648 \u0630\u062e\u06cc\u0631\u06c1 \u0634\u062f\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u06c1\u0679\u0627 \u062f\u06cc\u0627 \u062c\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<p>\u0627\u0646 \u0635\u0648\u0631\u062a\u0648\u06ba \u0645\u06cc\u06ba\u060c \u0622\u067e \u06a9\u0648 \u06cc\u06c1 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2 \u06a9\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0627\u0648\u0631 Elasticsearch \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0627\u0633\u0679\u0648\u0631\u06cc\u062c \u062f\u0648\u0646\u0648\u06ba \u0633\u06d2 \u0641\u0632\u06cc\u06a9\u0644 \u0688\u06cc\u0644\u06cc\u0679 \u06c1\u0648 \u062c\u0627\u0626\u06d2\u06d4<\/p>\n<p>\u0627\u06cc\u0633\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 <code>esClient.delete()<\/code> \u0641\u0646\u06a9\u0634\u0646 \u06a9\u0648 Elasticsearch \u06a9\u0644\u0627\u0626\u0646\u0679 ID \u0627\u0648\u0631 \u067e\u0648\u0633\u0679 \u06a9\u06cc \u0645\u0646\u0641\u0631\u062f ID \u06a9\u0648 \u067e\u0627\u0633 \u06a9\u0631\u06cc\u06ba \u062c\u0633\u06d2 \u0622\u067e \u06a9\u0627\u0644 \u0628\u06cc\u06a9 \u0622\u0631\u06af\u06cc\u0648\u0645\u06cc\u0646\u0679\u0633 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u062d\u0630\u0641 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 <code>esClient.delete<\/code> \u0641\u0646\u06a9\u0634\u0646<\/p>\n<pre><code class=\"language-javascript\">const deletePost = async (postId) => {\n  try {\n    await esClient.delete({\n      index: INDEX_NAME,\n      id: postId.toString(),\n    });\n\n    console.log(\"Post successfully deleted\");\n    return { success: true, postId };\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<h3 id=\"heading-how-to-index-a-post\">\u0627\u067e\u0646\u06cc \u067e\u0648\u0633\u0679\u0633 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0627\u067e\u0646\u0627 Elasticsearch \u0627\u0646\u0688\u06cc\u06a9\u0633 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0622\u067e \u0627\u067e\u0646\u06d2 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u067e\u0631 \u0644\u06a9\u06be\u06cc \u06af\u0626\u06cc \u067e\u0648\u0633\u0679\u0633 \u06a9\u0648 \u0627\u067e\u0646\u06d2 Elasticsearch \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u06ba \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<p>\u0627\u06cc\u0633\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e \u06a9\u0648 \u06cc\u06c1 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0646\u0627 \u06c1\u0648\u06af\u0627 \u06a9\u06c1 \u0622\u067e \u06a9\u06cc \u067e\u0648\u0633\u0679\u0633 \u0622\u067e \u06a9\u06d2 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0627\u0633\u06a9\u06cc\u0645\u0627 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0645\u0637\u0627\u0628\u0642\u062a \u0631\u06a9\u06be\u062a\u06cc \u06c1\u06cc\u06ba \u0628\u0630\u0631\u06cc\u0639\u06c1: <code>transformPostTOESRepo<\/code> \u0641\u0646\u06a9\u0634\u0646 \u06cc\u06c1 \u0641\u06cc\u0686\u0631 Elasticsearch \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u06d2 \u0688\u06be\u0627\u0646\u0686\u06d2 \u0633\u06d2 \u0645\u0644\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u0648\u0633\u0679 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0646\u06a9\u0627\u0644\u062a\u0627 \u0627\u0648\u0631 \u0641\u0627\u0631\u0645\u06cc\u0679 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">const transformPostToESDoc = (post) => {\n  return {\n  id: post.id,\n  title: post.title,\n  content: post.body,\n  author: post.author,\n  category: post.category,\n  tags: post.tags,\n  views: post.views || 0,\n  published_at: post.created_at\n};\n\nconst indexPost = async (postId) => {\n  try {\n    const postRepo = await getPostRepo();\n    const post = await postRepo.findOne({ where: { id: postId } });\n\n    if (!post) {\n      throw new Error(\"Post not available\");\n    }\n\n    const esDocument = transformPostToESDoc(post);\n\n    await esClient.index({\n      index: INDEX_NAME,\n      id: post.id.toString(),\n      document: esDocument\n    });\n\n    console.log(\"Post successfully indexed\");\n    return { success: true, postId };\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<p>\u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u06cc \u062c\u0627\u0646\u06d2 \u0648\u0627\u0644\u06cc \u067e\u0648\u0633\u0679\u0633 \u06a9\u0627 \u0627\u06cc\u06a9 \u0645\u0646\u0641\u0631\u062f ID \u06c1\u0648\u0646\u0627 \u0636\u0631\u0648\u0631\u06cc \u06c1\u06d2\u06d4 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0645\u06cc\u06ba \u0622\u0633\u0627\u0646\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u06c1\u0645 \u0646\u06d2 \u067e\u0648\u0633\u0679 \u0622\u0626\u06cc \u0688\u06cc \u06a9\u06cc \u0627\u0646\u0648\u06a9\u06be\u06cc \u0631\u06a9\u0627\u0648\u0679 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u062c\u0648 \u0628\u0627\u0642\u0627\u0639\u062f\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0645\u06cc\u06ba \u0645\u0639\u06cc\u0627\u0631\u06cc \u0622\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u062e\u062a\u06cc\u0627\u0631\u06cc \u0637\u0648\u0631 \u067e\u0631\u060c \u0622\u067e \u0627\u067e\u0646\u06cc \u067e\u0648\u0633\u0679 \u0622\u0626\u06cc \u0688\u06cc \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 UUID \u0644\u0627\u0626\u0628\u0631\u06cc\u0631\u06cc \u06a9\u0627 \u0628\u06be\u06cc \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u067e\u06be\u0631 \u067e\u0648\u0633\u0679 \u06a9\u06cc \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u06c1\u06d2\u06d4 <code>esClient.index()<\/code> \u06cc\u06c1 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0639\u0645\u0644 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u06c1\u0645 \u0646\u06d2 \u0622\u067e \u06a9\u06cc \u0627\u06cc\u067e \u06a9\u0648 \u06a9\u0631\u06cc\u0634 \u06c1\u0648\u0646\u06d2 \u0633\u06d2 \u0631\u0648\u06a9\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u063a\u0644\u0637\u06cc \u0633\u06d2 \u0646\u0645\u0679\u0646\u06d2 \u06a9\u06d2 \u0645\u0646\u0627\u0633\u0628 \u0627\u0642\u062f\u0627\u0645\u0627\u062a \u0628\u06be\u06cc \u06a9\u06cc\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-how-to-define-elastic-search-mapping-rules\">\u0644\u0686\u06a9\u062f\u0627\u0631 \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0646\u0642\u0634\u06c1 \u0633\u0627\u0632\u06cc \u06a9\u06d2 \u0642\u0648\u0627\u0639\u062f \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u06cc\u0633\u06d2 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>Elasticsearch \u0645\u06cc\u067e\u0646\u06af \u0627\u0633 \u0628\u0627\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u06a9\u06c1 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0627\u0633\u0679\u0648\u0631 \u0627\u0648\u0631 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u06c1\u0631 \u0641\u06cc\u0644\u0688 \u06a9\u06d2 \u0688\u06cc\u0679\u0627 \u06a9\u06cc \u0642\u0633\u0645 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u062a\u0646 \u06a9\u0627 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u06af\u0627\u06d4<\/p>\n<p>\u0630\u06cc\u0644 \u06a9\u06cc \u0645\u062b\u0627\u0644 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u062c\u0633 \u0645\u06cc\u06ba \u06c1\u0631 \u067e\u0648\u0633\u0679 \u0641\u06cc\u0644\u0688 (\u0639\u0646\u0648\u0627\u0646\u060c \u0645\u0648\u0627\u062f\u060c \u0645\u0635\u0646\u0641\u060c \u0648\u063a\u06cc\u0631\u06c1) \u06a9\u06d2 \u0644\u06cc\u06d2 \u062e\u0648\u062f\u06a9\u0627\u0631 \u062a\u06a9\u0645\u06cc\u0644 \u0627\u0648\u0631 \u0646\u0642\u0634\u06c1 \u0633\u0627\u0632\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u062d\u0633\u0628 \u0636\u0631\u0648\u0631\u062a \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631 \u0634\u0627\u0645\u0644 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">const indexMapping = {\n  settings: {\n    analysis: {\n      analyzer: {\n        autocomplete: {\n          type: 'custom',\n          tokenizer: 'standard',\n          filter: ['lowercase', 'autocomplete_filter']\n        },\n        autocomplete_search: {\n          type: 'custom',\n          tokenizer: 'standard',\n          filter: ['lowercase']\n        }\n      },\n      filter: {\n        autocomplete_filter: {\n          type: 'edge_ngram',\n          min_gram: 2,\n          max_gram: 10\n        }\n      }\n    }\n  },\n  mappings: {\n    properties: {\n      id: { type: 'integer' },\n      title: {\n        type: 'text',\n        analyzer: 'autocomplete',\n        search_analyzer: 'autocomplete_search',\n        fields: {\n          keyword: { type: 'keyword' },\n          standard: { type: 'text' }\n        }\n      },\n      content: {\n        type: 'text',\n        analyzer: 'standard'\n      },\n      category: {\n        type: 'keyword'\n      },\n      tags: { type: 'keyword' },\n      author: {\n        type: 'text',\n        fields: {\n          keyword: { type: 'keyword' }\n        }\n      },\n      views: { type: 'integer' },\n      published_at: { type: 'date' }\n    }\n  }\n};\n<\/code><\/pre>\n<p>\u06a9\u06c1 <code>indexMapping<\/code> \u0622\u0628\u062c\u06cc\u06a9\u0679 \u0627\u0633 \u0628\u0627\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u06a9\u0633 \u0637\u0631\u062d Elasticsearch \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0627\u0633\u0679\u0648\u0631 \u0627\u0648\u0631 \u067e\u0631\u0648\u0633\u06cc\u0633 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u062f\u0648 \u0627\u06c1\u0645 \u062d\u0635\u0648\u06ba \u067e\u0631 \u0645\u0634\u062a\u0645\u0644 \u06c1\u06d2: <code>settings<\/code> \u0627\u0648\u0631 <code>mappings<\/code>.<\/p>\n<p>\u06a9\u06c1 <code>mappings<\/code> \u062d\u0635\u06d2 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u06cc \u0633\u0627\u062e\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06c1\u0631 \u0641\u06cc\u0644\u0688\u060c \u062c\u06cc\u0633\u06d2 <code>title<\/code>\u060c <code>content<\/code>\u06cc\u0627 <code>author<\/code>\u0645\u0646\u062f\u0631\u062c\u06c1 \u0630\u06cc\u0644 \u0627\u0642\u0633\u0627\u0645 \u06c1\u06cc\u06ba: <code>text<\/code>\u060c <code>keyword<\/code>\u060c <code>integer<\/code>\u06cc\u0627 <code>date<\/code>. \u06cc\u06c1 Elasticsearch \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0627\u0646 \u0641\u06cc\u0644\u0688\u0632 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0627\u0633\u0679\u0648\u0631 \u0627\u0648\u0631 \u0628\u0627\u0632\u06cc\u0627\u0641\u062a \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0679\u06cc\u06a9\u0633\u0679 \u0641\u06cc\u0644\u0688\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e \u0627\u06cc\u06a9 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631 \u06a9\u06cc \u0628\u06be\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631 \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0645\u062a\u0646 \u06a9\u0648 \u0627\u0634\u0627\u0631\u06cc\u06c1 \u0633\u0627\u0632\u06cc \u0627\u0648\u0631 \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u062f\u0648\u0631\u0627\u0646 \u0686\u06be\u0648\u0679\u06d2 \u0686\u06be\u0648\u0679\u06d2 \u0679\u06a9\u0691\u0648\u06ba (\u0679\u0648\u06a9\u0646\u0632) \u0645\u06cc\u06ba \u06a9\u06cc\u0633\u06d2 \u062a\u0642\u0633\u06cc\u0645 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u067e\u0631 <code>settings<\/code> \u0633\u06cc\u06a9\u0634\u0646 \u0645\u06cc\u06ba \u06c1\u0645 \u0646\u06d2 \u062e\u0648\u062f\u06a9\u0627\u0631 \u062a\u06a9\u0645\u06cc\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u062d\u0633\u0628 \u0636\u0631\u0648\u0631\u062a \u062a\u062c\u0632\u06cc\u06c1 \u06a9\u0627\u0631 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u06cc \u06c1\u06d2\u06d4 \u06cc\u06c1 \u06c1\u06d2 <code>edge_ngram<\/code> \u06cc\u06c1 \u062c\u0632\u0648\u06cc \u0627\u0644\u0641\u0627\u0638 \u06a9\u06cc \u0645\u0645\u0627\u062b\u0644\u062a \u067e\u06cc\u062f\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0641\u0644\u0679\u0631\u0632 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062a\u0627\u06a9\u06c1 \u0635\u0627\u0631\u0641 \u0679\u0627\u0626\u067e \u06a9\u0631\u062a\u06d2 \u0648\u0642\u062a \u0646\u062a\u0627\u0626\u062c \u062a\u0644\u0627\u0634 \u06a9\u0631 \u0633\u06a9\u06cc\u06ba\u06d4 \u06c1\u0645\u0627\u0631\u06d2 \u067e\u0627\u0633 \u0628\u06be\u06cc \u0627\u0644\u06af \u06c1\u06d2\u06d4 <code>search_analyzer<\/code> \u0627\u0633 \u0628\u0627\u062a \u06a9\u0648 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0627\u0635\u0637\u0644\u0627\u062d\u0627\u062a \u067e\u0631 \u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0639\u0645\u0644 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u0633\u0627\u062a\u06be\u060c \u06cc\u06c1 \u062a\u0631\u062a\u06cc\u0628\u0627\u062a \u062e\u0648\u062f\u06a9\u0627\u0631 \u062a\u06a9\u0645\u06cc\u0644 \u062c\u06cc\u0633\u06cc \u062e\u0635\u0648\u0635\u06cc\u0627\u062a \u06a9\u0648 \u0633\u067e\u0648\u0631\u0679 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0646\u062a\u0627\u0626\u062c \u06a9\u0648 \u062f\u0631\u0633\u062a \u0627\u0648\u0631 \u0645\u0648\u062b\u0631 \u0631\u06a9\u06be\u0646\u06d2 \u0645\u06cc\u06ba \u0645\u062f\u062f \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-search-implementation\">\u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0646\u0641\u0627\u0630<\/h2>\n<p>\u062a\u0644\u0627\u0634 \u06a9\u06cc \u0641\u0639\u0627\u0644\u06cc\u062a \u06a9\u0648 \u0646\u0627\u0641\u0630 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e \u06a9\u0648 \u0627\u06cc\u06a9 API \u0628\u0646\u0627\u0646\u0627 \u06c1\u0648\u06af\u0627\u06d4 \u0627\u0633 \u0645\u06cc\u06ba \u0628\u0632\u0646\u0633 \u0644\u0627\u062c\u06a9 \u0633\u0631\u0648\u0633\u0632 \u0627\u0648\u0631 API \u0631\u0648\u0679\u0633 \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0631 \u0634\u0627\u0645\u0644 \u06c1\u06d2\u06d4 \u062a\u0645 \u0628\u06be\u06cc <code>GET<\/code> \u0627\u06cc\u06a9 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0627\u067e\u0646\u06cc \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0627\u0635\u0637\u0644\u0627\u062d\u0627\u062a \u0628\u0637\u0648\u0631 \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u0645\u0646\u0633\u0644\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4 \u062a\u06cc\u0627\u0631 \u06a9\u0631\u062f\u06c1 \u0646\u062a\u0627\u0626\u062c JSON \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0645\u0648\u0635\u0648\u0644 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0644\u0627\u060c \u0622\u0626\u06cc\u06d2 \u0633\u0631\u0686 \u067e\u0648\u0633\u0679 \u0633\u0631\u0648\u0633 \u06a9\u06cc \u0641\u0639\u0627\u0644\u06cc\u062a \u06a9\u0648 \u0646\u0627\u0641\u0630 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633 \u0645\u0646\u0638\u0631 \u0646\u0627\u0645\u06d2 \u0645\u06cc\u06ba\u060c \u0622\u067e \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u062c\u0645\u0644\u06d2 \u062a\u0644\u0627\u0634 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0633\u0631\u0686 \u0627\u0646\u062c\u0646 \u06a9\u06cc \u0641\u0639\u0627\u0644\u06cc\u062a \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba \u06af\u06d2\u06d4 \u06c1\u0645 \u0635\u0641\u062d\u06c1 \u0628\u0646\u062f\u06cc \u06a9\u06cc \u062a\u06a9\u0646\u06cc\u06a9\u0648\u06ba \u06a9\u0648 \u0628\u06c1\u062a\u0631\u06cc\u0646 \u0637\u0631\u06cc\u0642\u0648\u06ba \u06a9\u06d2 \u0645\u0637\u0627\u0628\u0642 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u063a\u06cc\u0631 \u0645\u0646\u0642\u0648\u0644\u06c1 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u0648 \u06a9\u0645 \u0633\u06d2 \u06a9\u0645 \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u06d2\u06d4<\/p>\n<p>\u062a\u0644\u0627\u0634 \u06a9\u06cc \u0627\u0635\u0637\u0644\u0627\u062d\u0627\u062a \u0645\u06cc\u06ba \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0627 \u0646\u0627\u0645\u060c \u0635\u0641\u062d\u06c1 \u0628\u0646\u062f\u06cc \u06a9\u06d2 \u067e\u06cc\u0631\u0627\u0645\u06cc\u0679\u0631\u0632 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba (<code>from<\/code> \u0627\u0648\u0631 <code>size<\/code>) \u0648\u0627\u067e\u0633 \u0622\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0627\u0648\u0631 \u0645\u062a\u0648\u0642\u0639 \u0646\u062a\u0627\u0626\u062c \u06a9\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0633\u0627\u0626\u0632 \u06a9\u0648 \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06c1\u0645 \u0627\u06cc\u06a9 \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u0622\u0628\u062c\u06cc\u06a9\u0679 \u0628\u06be\u06cc \u0645\u0646\u0633\u0644\u06a9 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0641\u0627\u0631\u0645 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 Elasticsearch \u0627\u0646\u062c\u0646 \u06a9\u0648 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">const searchElastic = async (query, page = 1, size = 10) => {\n  const searchQuery = {\n    index: INDEX_NAME,\n    from: (page - 1) * size,\n    size,\n    query: {\n      bool: {\n        must: [\n          {\n            multi_match: {\n              query,\n              fields: [\"title^3\", \"content\"],\n              type: \"best_fields\",\n              fuzziness: \"AUTO\"\n            }\n          }\n        ]\n      }\n    }\n  };\n\n  const result = await esClient.search(searchQuery);\n  return result.hits.hits;\n};\n<\/code><\/pre>\n<p>\u0645\u0646\u062f\u0631\u062c\u06c1 \u0628\u0627\u0644\u0627 \u06a9\u0648\u0688 \u0645\u06cc\u06ba\u060c \u0641\u0646\u06a9\u0634\u0646 \u06a9\u0627 \u0646\u0627\u0645 \u06c1\u06d2: <code>searchElastic<\/code>. \u0627\u0633 \u0641\u0646\u06a9\u0634\u0646 \u0645\u06cc\u06ba \u062a\u06cc\u0646 \u0645\u062a\u063a\u06cc\u0631\u0627\u062a \u06c1\u06cc\u06ba \u062c\u0646\u06c1\u06cc\u06ba \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u0627\u0633 \u06a9\u0631\u0646\u0627 \u0636\u0631\u0648\u0631\u06cc \u06c1\u06d2\u06d4 <code>size<\/code>\u060c <code>page<\/code> \u0627\u0648\u0631 <code>query<\/code>.<\/p>\n<p>\u06a9\u06c1 <code>size<\/code> \u0645\u062a\u063a\u06cc\u0631 \u0641\u06cc \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0627\u0635\u0637\u0644\u0627\u062d \u0645\u06cc\u06ba \u0648\u0627\u067e\u0633 \u06a9\u06cc\u06d2 \u062c\u0627\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632\u0627\u062a \u06a9\u06cc \u0632\u06cc\u0627\u062f\u06c1 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0639\u062f\u0627\u062f \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0688\u06cc\u0641\u0627\u0644\u0679 \u0646\u0645\u0628\u0631 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0639\u062f\u062f \u06c1\u0648 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u06cc\u06c1 \u06c1\u06d2\u06d4 <code>multi_match<\/code> \u0627\u06cc\u06a9 \u0634\u0642 \u062c\u0648 \u0645\u062a\u0639\u062f\u062f \u0634\u0639\u0628\u0648\u06ba \u06a9\u0648 \u062a\u0644\u0627\u0634 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u060c \u062c\u06cc\u0633\u06d2: <code>title<\/code> \u0627\u0648\u0631 <code>content<\/code>. \u06a9\u06c1 <code>title^3<\/code> \u0646\u062d\u0648 \u0679\u0627\u0626\u0679\u0644 \u0645\u06cc\u06ba \u0645\u06cc\u0686\u0648\u06ba \u06a9\u0648 \u0645\u0636\u0628\u0648\u0637 \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0646\u06c1\u06cc\u06ba \u062f\u0648\u0633\u0631\u06d2 \u0634\u0639\u0628\u0648\u06ba \u06a9\u06d2 \u0645\u06cc\u0686\u0648\u06ba \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0645\u062a\u0639\u0644\u0642\u06c1 \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u06c1\u0645 \u0628\u06be\u06cc <code>must<\/code> \u0627\u06cc\u06a9 \u0634\u0642 \u062c\u0648 \u0627\u0646 \u0634\u0631\u0627\u0626\u0637 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u062c\u0648 \u06a9\u0633\u06cc \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u0648 \u0646\u062a\u0627\u0626\u062c \u0645\u06cc\u06ba \u0634\u0627\u0645\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0645\u0627\u062b\u0644 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<p>\u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0646\u062a\u0627\u0626\u062c \u06a9\u0648 \u0639\u0627\u0645 \u0637\u0648\u0631 \u067e\u0631 \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0627\u0635\u0637\u0644\u0627\u062d \u0633\u06d2 \u0627\u0646 \u06a9\u06cc \u0645\u0637\u0627\u0628\u0642\u062a \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 \u062f\u0631\u062c\u06c1 \u0628\u0646\u062f\u06cc \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-full-code\">\u0645\u06a9\u0645\u0644 \u06a9\u0648\u0688<\/h2>\n<p>\u0627\u0628 \u0622\u067e \u0646\u06d2 \u06cc\u06c1 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u0645\u06a9\u0645\u0644 \u06a9\u0631 \u0644\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 Elasticsearch \u06a9\u0648 \u0627\u067e\u0646\u06d2 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u067e\u0631 \u0644\u06a9\u06be\u06cc \u06af\u0626\u06cc \u067e\u0648\u0633\u0679\u0633 \u06a9\u0648 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u06c1\u06d2\u06d4 \u0645\u06a9\u0645\u0644 \u06a9\u0648\u0688 \u0630\u06cc\u0644 \u0645\u06cc\u06ba \u06c1\u06d2:<\/p>\n<ol>\n<li>Elasticsearch \u06a9\u0644\u0627\u0626\u0646\u0679 (config.js):<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const { Client } = require('@elastic\/elasticsearch');\n\nconst esClient = new Client({\n  node: 'http:\/\/localhost:9200',\n  auth: {\n    username: process.env.ELASTICSEARCH_USERNAME,\n    password: process.env.ELASTICSEARCH_PASSWORD\n  },\n  maxRetries: 5,\n  requestTimeout: 60000,\n  tls: {\n    rejectUnauthorized: process.env.NODE_ENV !== 'development'\n  }\n});\n\nmodule.exports = esClient;\n<\/code><\/pre>\n<ol>\n<li>\u0627\u0646\u0688\u06cc\u06a9\u0633 \u0645\u06cc\u067e\u0646\u06af:<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const indexMapping = {\n  settings: {\n    analysis: {\n      analyzer: {\n        autocomplete: {\n          type: 'custom',\n          tokenizer: 'standard',\n          filter: ['lowercase', 'autocomplete_filter']\n        },\n        autocomplete_search: {\n          type: 'custom',\n          tokenizer: 'standard',\n          filter: ['lowercase']\n        }\n      },\n      filter: {\n        autocomplete_filter: {\n          type: 'edge_ngram',\n          min_gram: 2,\n          max_gram: 10\n        }\n      }\n    }\n  },\n  mappings: {\n    properties: {\n      id: { type: 'integer' },\n      title: {\n        type: 'text',\n        analyzer: 'autocomplete',\n        search_analyzer: 'autocomplete_search',\n        fields: {\n          keyword: { type: 'keyword' },\n          standard: { type: 'text' }\n        }\n      },\n      content: {\n        type: 'text',\n        analyzer: 'standard'\n      },\n      category: {\n        type: 'keyword'\n      },\n      tags: { type: 'keyword' },\n      author: {\n        type: 'text',\n        fields: {\n          keyword: { type: 'keyword' }\n        }\n      },\n      views: { type: 'integer' },\n      published_at: { type: 'date' }\n    }\n  }\n};\n<\/code><\/pre>\n<ol>\n<li>\u0627\u0646\u0688\u06cc\u06a9\u0633 \u062a\u062e\u0644\u06cc\u0642:<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const setupIndex = async () => {\n  try {\n    const indexExists = await esClient.indices.exists({\n      index: INDEX_NAME\n    });\n\n    if (indexExists) {\n      console.log(`Index \"${INDEX_NAME}\" already exists`);\n      return;\n    }\n\n    await esClient.indices.create({\n      index: INDEX_NAME,\n      ...indexMapping\n    });\n\n    console.log(`Index \"${INDEX_NAME}\" created`);\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<ol>\n<li>\u0627\u0634\u0627\u0631\u06cc\u06c1 \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba:<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const deleteIndex = async () => {\n  try {\n    await esClient.indices.delete({ index: INDEX_NAME });\n    console.log(`${INDEX_NAME} deleted`);\n  } catch (err) {\n    console.error(\"Error deleting index:\", err);\n  }\n};\n<\/code><\/pre>\n<ol>\n<li>\u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u0648 \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba (\u067e\u0648\u0633\u0679):<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const deletePost = async (postId) => {\n  try {\n    await esClient.delete({\n      index: INDEX_NAME,\n      id: postId.toString()\n    });\n\n    console.log(\"Post successfully deleted\");\n    return { success: true, postId };\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<ol>\n<li>\u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0646\u0688\u06cc\u06a9\u0633 \u0634\u0627\u0626\u0639 \u06a9\u0631\u06cc\u06ba:<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const transformPostToESDoc = (post) => {\n  return {\n  id: post.id,\n  title: post.title,\n  content: post.body,\n  author: post.author,\n  category: post.category,\n  tags: post.tags,\n  views: post.views || 0,\n  published_at: post.created_at\n};\n\nconst indexPost = async (postId) => {\n  try {\n    const postRepo = await getPostRepo();\n    const post = await postRepo.findOne({ where: { id: postId } });\n\n    if (!post) {\n      throw new Error(\"Post not available\");\n    }\n\n    const esDocument = transformPostToESDoc(post);\n\n    await esClient.index({\n      index: INDEX_NAME,\n      id: post.id.toString(),\n      document: esDocument\n    });\n\n    console.log(\"Post successfully indexed\");\n    return { success: true, postId };\n  } catch (err) {\n    console.error(err);\n    throw err;\n  }\n};\n<\/code><\/pre>\n<ol>\n<li>\u062a\u0644\u0627\u0634 \u06a9\u06cc \u062a\u0642\u0631\u06cc\u0628:<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const searchElastic = async (query, page = 1, size = 10) => {\n  const searchQuery = {\n    index: INDEX_NAME,\n    from: (page - 1) * size,\n    size,\n    query: {\n      bool: {\n        must: [\n          {\n            multi_match: {\n              query,\n              fields: [\"title^3\", \"content\"],\n              type: \"best_fields\",\n              fuzziness: \"AUTO\"\n            }\n          }\n        ]\n      }\n    }\n  };\n\n  const result = await esClient.search(searchQuery);\n  return result.hits.hits;\n};\n<\/code><\/pre>\n<h2 id=\"heading-wrapping-up\">\u062e\u062a\u0645<\/h2>\n<p>\u0627\u0628 \u0622\u067e \u062c\u0627\u0646\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0627\u067e\u0646\u06cc \u0648\u06cc\u0628 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646\u0632 \u0645\u06cc\u06ba \u0635\u0627\u0631\u0641 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u06a9\u0648 \u0628\u06c1\u062a\u0631 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 Elasticsearch \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633\u06d2 \u06a9\u0631\u06cc\u06ba\u06d4 Elasticsearch agnostic \u06c1\u06d2\u060c \u0644\u06c1\u0630\u0627 \u0627\u0633\u06d2 \u067e\u0631\u0648\u06af\u0631\u0627\u0645\u0646\u06af \u0632\u0628\u0627\u0646\u0648\u06ba \u0627\u0648\u0631 \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u06c1\u0645\u0627\u0631\u0627 \u0628\u0691\u0627 \u06a9\u0645\u06cc\u0648\u0646\u0679\u06cc \u0628\u06cc\u0633 \u0622\u0646 \u0628\u0648\u0631\u0688\u0646\u06af \u06a9\u0648 \u0622\u0633\u0627\u0646 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u062f\u062f\u06af\u0627\u0631 \u0635\u0627\u0631\u0641 \u06af\u0627\u0626\u06cc\u0688 \u0628\u06be\u06cc \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>Elasticsearch \u06a9\u06cc \u0637\u0627\u0642\u062a \u0633\u06d2 \u0645\u0632\u06cc\u062f \u0641\u0627\u0626\u062f\u06c1 \u0627\u0679\u06be\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0622\u067e \u0627\u0633 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u062f\u06cc\u06af\u0631 \u0679\u0648\u0644\u0632 \u06a9\u0648 \u062a\u0644\u0627\u0634 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba: <strong>\u0627\u06cc\u0644\u06a9<\/strong> \u062e\u0627\u0635 \u0637\u0648\u0631 \u067e\u0631\u060c \u0627\u06cc\u06a9 \u0627\u0633\u0679\u06cc\u06a9 (Elasticsearch\u060c Log Stash\u060c \u0627\u0648\u0631 Kibana) \u062c\u0648 \u0627\u0646\u0679\u0631\u067e\u0631\u0627\u0626\u0632 \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646\u0632 \u0645\u06cc\u06ba \u0688\u06cc\u0679\u0627 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0639\u0644\u06cc\u0670 \u0645\u0639\u06cc\u0627\u0631 \u06a9\u06d2 \u0688\u06cc\u0679\u0627 \u0648\u06cc\u0698\u0648\u0644\u0627\u0626\u0632\u06cc\u0634\u0646 \u0628\u0646\u0627\u0646\u06d2 \u0645\u06cc\u06ba \u0645\u062f\u062f \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-conclusion\">\u0646\u062a\u06cc\u062c\u06c1<\/h2>\n<p>\u0627\u0646 \u062f\u0646\u0648\u06ba \u0648\u06cc\u0628 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646\u0632 \u0645\u06cc\u06ba \u062a\u06cc\u0632 \u0627\u0648\u0631 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u0633\u0631\u0686 \u0627\u0646\u062c\u0646 \u062f\u0633\u062a\u06cc\u0627\u0628 \u0646\u06c1\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u0627\u0633 \u06a9\u0627\u0645 \u06a9\u0648 \u067e\u0648\u0631\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 Elasticsearch \u0627\u06cc\u06a9 \u0636\u0631\u0648\u0631\u06cc \u0679\u0648\u0644 \u06c1\u06d2\u06d4<\/p>\n<p>\u062f\u0648\u0633\u0631\u06d2 \u0645\u0636\u0627\u0645\u06cc\u0646 \u06a9\u0648 \u067e\u0691\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062c\u0648 \u0622\u067e \u06a9\u06d2 \u062a\u06a9\u0646\u06cc\u06a9\u06cc \u0633\u0641\u0631 \u0645\u06cc\u06ba \u0627\u0636\u0627\u0641\u06c1 \u06a9\u0631\u06cc\u06ba \u06af\u06d2\u060c \u0645\u06cc\u0631\u06cc \u0648\u06cc\u0628 \u0633\u0627\u0626\u0679 \u06cc\u06c1\u0627\u06ba \u062f\u06cc\u06a9\u06be\u06cc\u06ba\u06d4 \u0645\u062a\u062d\u0631\u06a9 \u0631\u06c1\u06cc\u06ba!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0648\u06c1 \u06a9\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0688\u06cc\u0679\u0627 \u0646\u06cc\u0627 \u0633\u0648\u0646\u0627 \u06c1\u06d2\u06d4 \u062a\u0627\u06c1\u0645\u060c \u0631\u06cc\u06a9\u0627\u0631\u0688 \u0648\u0642\u062a \u0645\u06cc\u06ba \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06d2 \u0645\u0637\u0627\u0644\u0628\u0627\u062a \u06a9\u0648 \u067e\u0648\u0631\u0627 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u0691\u06d2 \u0688\u06cc\u0679\u0627 \u0633\u06cc\u0679\u0633 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u0628\u06cc\u06a9 \u0627\u06cc\u0646\u0688 \u0688\u0648\u06cc\u0644\u067e\u0631\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0631\u062f \u0633\u0631 \u0628\u0646\u06cc \u06c1\u0648\u0626\u06cc \u06c1\u06d2\u06d4 \u0631\u0648\u0627\u06cc\u062a\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06d2 \u0633\u0648\u0627\u0644\u0627\u062a \u0627\u06a9\u062b\u0631 \u062f\u0631\u0633\u062a \u062a\u0644\u0627\u0634 \u06a9\u06d2 \u0646\u062a\u0627\u0626\u062c \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u0646\u06c1\u06cc\u06ba [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":22688,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-22687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/22687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/comments?post=22687"}],"version-history":[{"count":1,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/22687\/revisions"}],"predecessor-version":[{"id":22689,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/22687\/revisions\/22689"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media\/22688"}],"wp:attachment":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media?parent=22687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/categories?post=22687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/tags?post=22687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}