{"id":223109,"date":"2014-05-16T18:59:03","date_gmt":"2014-05-16T14:59:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=223109"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=223109","title":{"rendered":"<span class=\"post_title\">\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043e\u0442 MongoDB Full Text \u043a ElasticSearch<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c <a href=\"http:\/\/habrahabr.ru\/company\/likeastore\/blog\/222515\/\">\u043f\u043e\u0441\u0442\u0435<\/a>, \u0441 \u0430\u043d\u043e\u043d\u0441\u043e\u043c Google Chrome \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f <a href=\"https:\/\/likeastore.com\">Likeastore<\/a>, \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/elasticsearch.com\">ElasticSeach<\/a>. \u0418\u043c\u0435\u043d\u043d\u043e ElasticSeach \u0434\u0430\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043a \u0445\u0440\u043e\u043c\u0443.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u043a\u0438 MongoDB + ElasticSeach, \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 NoSQL \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 ElasticSearch, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c MongoDB.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/h4>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430, \u0441\u0443\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0440\u0435\u0434\u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u0441\u0432\u043e\u0438\u0445 \u043b\u0430\u0439\u043a\u043e\u0432, \u0431\u044b\u043b\u043e \u0442\u043e, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  \u0413\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0431\u044b\u043b\u043e, \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c MongoDB Full Text Search. \u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 2.4 full text \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439, \u043e\u043d \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0435\u0433\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u0412\u0440\u0435\u043c\u044f \u0448\u043b\u043e \u0438 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u043e\u0441\u043b\u0430. \u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432 2 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u044f \u0441\u0442\u0430\u043b \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0432 \u0432\u0438\u0434\u0435 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u0440\u0438\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0441\u044f \u043a \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430\u043c, \u043a\u0430\u043a <a href=\"http:\/\/elasticsearch.com\">ElasticSearch<\/a>, <a href=\"http:\/\/lucene.apache.org\/solr\/\">Solr<\/a> \u0438\u043b\u0438 <a href=\"http:\/\/sphinxsearch.com\/\">Shpinx<\/a>. \u041d\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u043b\u0430\u0435\u0442 \u0432 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435, \u043f\u043e\u043a\u0430 \u00ab\u0433\u0440\u043e\u043c \u043d\u0435 \u0433\u0440\u044f\u043d\u0435\u0442, \u043c\u0443\u0436\u0438\u043a \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442\u00bb.<\/p>\n<p>  \u0413\u0440\u043e\u043c \u00ab\u0433\u0440\u044f\u043d\u0443\u043b\u00bb 2 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434, \u043f\u043e\u0441\u043b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043c\u044b \u0438\u0441\u043f\u044b\u0442\u0430\u043b\u0438 \u0440\u0435\u0437\u043a\u043e\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0444\u0438\u043a\u0430 \u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c. New Relic \u0441\u043b\u0430\u043b \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0435 \u043f\u0438\u0441\u044c\u043c\u0430, \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0430 \u0441\u043e\u0431\u0441\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u2014 \u043f\u0430\u0446\u0438\u0435\u043d\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0436\u0438\u0432, \u0447\u0435\u043c \u043c\u0435\u0440\u0442\u0432, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e.<\/p>\n<p>  \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c HTTP \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u043e\u0432 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 504, \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a MongoDB. \u041c\u044b \u0445\u043e\u0441\u0442\u0438\u043c\u0441\u044f \u043d\u0430 MongoHQ, \u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0440\u043e\u0432\u043d\u044b\u043c \u0441\u0447\u0435\u0442\u043e\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u043b\u043e. \u0411\u0430\u0437\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0442\u0430\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u044f \u0432\u0438\u0434\u0435\u043b, \u0447\u0442\u043e Locked % \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0437\u0430\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 110 \u2014 140% \u0438 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0442\u0430\u043c, \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043d\u0438\u0437.<\/p>\n<p>  \u0421\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043b\u0430\u0439\u043a\u0438, \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e insert&#8217;\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u043e\u0439 insert \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0440\u0435-\u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0446\u0438\u044e \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u044d\u0442\u043e \u0434\u043e\u0440\u043e\u0433\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430), \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043f\u0435\u0440\u043b\u0438\u0441\u044c \u0432 \u0435\u0435 \u043f\u0440\u0435\u0434\u0435\u043b.<\/p>\n<p>  \u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Locked index \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u043b 0.7%, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c, \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c \u00absorry, search is on maintenance\u00bb\u2026<\/p>\n<h4>\u041f\u0440\u043e\u0431\u0443\u0435\u043c ElasticSeach \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e<\/h4>\n<p>  \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f Elastic, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b (\u0435\u0441\u0442\u044c, \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0431\u0443\u0434\u0435\u0442) <a href=\"http:\/\/www.vagrantup.com\/\">vagrant<\/a>.<\/p>\n<p>  ElasticSeach \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Java, \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430.<\/p>\n<pre><code class=\"bash\">&gt; sudo apt-get update &gt; sudo apt-get install openjdk-6-jre &gt; sudo add-apt-repository ppa:webupd8team\/java &gt; sudo apt-get install oracle-java7-installer <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 <\/p>\n<pre><code class=\"bash\">&gt; java --version <\/code><\/pre>\n<p>  \u0421\u0430\u043c Elastic \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438\u0437 Debian \u043f\u0430\u043a\u0435\u0442\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0435\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441, \u0430 \u043d\u0435 \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<pre><code class=\"bash\">&gt; wget https:\/\/download.elasticsearch.org\/elasticsearch\/elasticsearch\/elasticsearch-1.1.1.deb &gt; dpkg -i elasticsearch-1.1.1.deb <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043e\u043d \u0433\u043e\u0442\u043e\u0432 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443,<\/p>\n<pre><code class=\"bash\">&gt; sudo update-rc.d elasticsearch defaults 95 10 &gt; sudo \/etc\/init.d\/elasticsearch start <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432 \u0441\u0432\u043e\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<pre><code class=\"bash\">{   &quot;ok&quot; : true,   &quot;status&quot; : 200,   &quot;name&quot; : &quot;Xavin&quot;,   &quot;version&quot; : {     &quot;number&quot; : &quot;1.1.1&quot;,     &quot;build_hash&quot; : &quot;36897d07dadcb70886db7f149e645ed3d44eb5f2&quot;,     &quot;build_timestamp&quot; : &quot;2014-05-05T12:06:54Z&quot;,     &quot;build_snapshot&quot; : false,     &quot;lucene_version&quot; : &quot;4.5.1&quot;   },   &quot;tagline&quot; : &quot;You Know, for Search&quot; } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 10 \u043c\u0438\u043d\u0443\u0442.<\/p>\n<h4>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c<\/h4>\n<p>  ElasticSearch \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0432\u0435\u0440\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 <a href=\"http:\/\/lucene.apache.org\/core\/\">Lucene<\/a>. \u042d\u0442\u043e \u0431\u0435\u0437 \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0439 \u0441\u043b\u043e\u0436\u043d\u0435\u0439\u0448\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043e\u0442\u0442\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u0433\u043e\u0434\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u044b\u043b\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043e \u0442\u044b\u0441\u044f\u0447\u0438 \u0442\u0440\u0443\u0434\u043e-\u0447\u0430\u0441\u043e\u0432 \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0445 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432. Elastic, \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043c\u0435\u0440\u0442\u043d\u044b\u043c, \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  \u042f \u043d\u0430\u0445\u043e\u0436\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438, \u043c\u0435\u0436\u0434\u0443 Elastic&#8217;\u043e\u043c \u0438 CounchDB \u2014 \u0442\u043e\u0436\u0435 HTTP API, \u0442\u043e\u0436\u0435 schemaless, \u0442\u0430\u0436\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0447\u0438\u0442\u0430\u044f <a href=\"http:\/\/www.elasticsearch.org\/guide\/\">\u043c\u0430\u043d\u0443\u0430\u043b<\/a>, \u0441\u043c\u043e\u0442\u0440\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0435 <a href=\"http:\/\/www.elasticsearch.org\/videos\/\">\u0432\u0438\u0434\u043e\u0441\u044b<\/a>, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0433\u043e\u043b\u044b\u0439 curl, \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041d\u043e \u0434\u043e\u043b\u0433\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u00ab\u043d\u0430 \u043a\u043e\u0448\u043a\u0430\u0445\u00bb, \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u0430\u043c\u043f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d MongoDB \u0431\u0430\u0437\u044b, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0433\u043d\u0430\u0442\u044c \u0432\u0441\u044e \u0441\u0432\u043e\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0438\u0437 MongoDB \u0432 ElasticSearch \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0443\u043b \u2014 <a href=\"https:\/\/github.com\/likeastore\/elaster\">elaster<\/a>. Elaster, \u044d\u0442\u043e node.js \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0442\u0440\u0438\u043c\u043c\u0438\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e MongoDB, \u0432 ElasticSearch, \u043f\u0440\u0435\u0434\u0432\u0430\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u043e\u043c.<\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u044d\u0442\u043e\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 (\u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0443 \u0438\u0434\u0435\u0439, \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f elaster) \u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0447\u0435\u0440\u0435\u0437 40 \u043c\u0438\u043d\u0443\u0442, \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 MongoDB \u0431\u044b\u043b\u0438 \u0432 ElasticSearch, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u0430\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/dc2\/8e9\/88d\/dc28e988de7e1f2d3bc9ca3040eb3be3.png\" alt=\"image\"\/><\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h4>\n<p>  <a href=\"http:\/\/www.elasticsearch.org\/guide\/en\/elasticsearch\/reference\/current\/query-dsl.html\">Query DSL<\/a>, \u044f\u0437\u044b\u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a Elastic. \u041f\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 JSON, \u043d\u043e \u0432\u043e\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u044d\u0442\u043e \u043e\u043f\u044b\u0442, \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0438 \u0437\u043d\u0430\u043d\u0438\u044f. \u042f \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c \u0447\u0435\u0441\u043d\u043e \u0438\u0445 \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">function fullTextItemSearch (user, query, paging, callback) {   if (!query) {       return callback(null, { data: [], nextPage: false });   }    var page = paging.page || 1;    elastic.search({       index: 'items',       from: (page - 1) * paging.pageSize,       size: paging.pageSize,       body: {           query: {               filtered: {                   query: {                       'query_string': {                           query: query                       },                   },                   filter: {                       term: {                           user: user.email                       }                   }               }           }       }   }, function (err, resp) {       if (err) {           return callback(err);       }        var items = resp.hits.hits.map(function (hit) {           return hit._source;       });        callback(null, {data: items, nextPage: items.length === paging.pageSize});   }); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0441 \u043f\u0435\u0439\u0434\u0436\u0438\u043d\u0433\u043e\u043c, \u0434\u043b\u044f \u0432\u044b\u0434\u0430\u0447\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u044f \u0431\u044b\u043b \u043f\u043e\u0440\u0430\u0436\u0435\u043d \u043a\u0430\u043a \u043a\u0440\u0443\u0442 Elastic. \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 30-40\u043c\u0441, \u0438 \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0442\u043e\u043d\u043a\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u044f \u0431\u044b\u043b \u0434\u043e\u0432\u043e\u043b\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0447\u0438!<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 ElasticSeach \u0432\u0445\u043e\u0434\u0438\u0442 Hightligh API, \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0420\u0430\u0441\u0448\u0438\u0440\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441, \u0434\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430<\/p>\n<pre><code class=\"javascript\">\telastic.search({ \t\tindex: 'items', \t\tfrom: (page - 1) * paging.pageSize, \t\tsize: paging.pageSize, \t\tbody: { \t\t\tquery: { \t\t\t\tfiltered: { \t\t\t\t\tquery: { \t\t\t\t\t\t'query_string': { \t\t\t\t\t\t\tquery: query \t\t\t\t\t\t}, \t\t\t\t\t}, \t\t\t\t\tfilter: { \t\t\t\t\t\tterm: { \t\t\t\t\t\t\tuser: user.email \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t}, \t\t\t}, \t\t\thighlight: { \t\t\t\tfields: { \t\t\t\t\tdescription: { }, \t\t\t\t\ttitle: { }, \t\t\t\t\tsource: { } \t\t\t\t} \t\t\t} \t\t} <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0441\u043f\u043e\u043d\u0441\u0435 \u043d\u0430 \u043d\u0435\u0433\u043e (\u043e\u0431\u044a\u0435\u043a\u0442 hit) \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 highlight, c HTML-\u043e\u043c, \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442-\u0435\u043d\u0434\u0435, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0435,<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b3e\/3ba\/258\/b3e3ba2588c5cb66c13eb0635abd8e01.png\" alt=\"image\"\/><\/p>\n<h4>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 MongoDB (\u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435) \u00ab\u043f\u0435\u0440\u0435\u0442\u0435\u043a\u0430\u043b\u0438\u00bb \u0432 ElasticSearch.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b, \u0442.\u043d. rivers. \u0418\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f MongoDB, \u0441\u0430\u043c\u044b\u0439 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/richardwilly98\/elasticsearch-river-mongodb\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  River \u0434\u043b\u044f MongoDB \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 oplog \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u044b, \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 oplog \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 ElasticSeach \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e\u0442 \u043f\u043b\u0430\u0433\u0438\u043d \u0441 MongoHQ (\u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043a\u0440\u0438\u0437\u043d\u044b \u043c\u043e\u0438\u0445 \u0440\u0443\u043a, \u0438\u0431\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u043e\u043b\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0439).<\/p>\n<p>  \u041d\u043e \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0443\u0442\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043c\u0435\u043d\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e insert \u0438 find, \u043c\u043d\u0435 \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 insert`\u0430 \u0432 MongoDB, \u044f \u0434\u0435\u043b\u0430\u044e bulk \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0443 \u0432 ElasticSeach. <\/p>\n<pre><code class=\"javascript\">\tasync.waterfall([ \t\treadUser, \t\texecuteConnector, \t\tfindNew, \t\tsaveToMongo, \t\tsaveToEleastic, \t\tsaveState \t], function (err, results) {   }); <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f, saveToElastic <\/p>\n<pre><code class=\"javascript\">\t\tvar commands = []; \t\titems.forEach(function (item) { \t\t\tcommands.push({'index': {'_index': 'items', '_type': 'item', '_id': item._id.toString()}}); \t\t\tcommands.push(item); \t\t});  \t\telastic.bulk({body: commands}, callback); <\/code><\/pre>\n<p>  \u041d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e, \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 river \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043e.<\/p>\n<h4>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0438\u043d\u0435<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0438\u043d\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u043e\u0432\u044b\u0439 \u0434\u0440\u043e\u043f\u043b\u0435\u0442 \u043d\u0430 <a href=\"https:\/\/www.digitalocean.com\/?refcode=de56d081b272\">Digital Ocean<\/a> (2 CPU, 2 GB, 40 GB SDD) \u0438 \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u043b \u0441 \u043d\u0438\u043c \u0432\u0441\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c ElasticSeach, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c node.js \u0438 git, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c elaster \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0431\u044b\u043b \u043f\u043e\u0434\u043d\u044f\u0442 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 Likeastore API, \u0443\u0436\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0434 Elastic. \u0412\u0441\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u0433\u043b\u0430\u0434\u043a\u043e \u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0438\u043d\u0435 \u0443\u0436\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u043e\u0432 \u043d\u0435\u0431\u044b\u043b\u043e.<\/p>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h4>\n<p>  \u0421\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u044f \u0434\u043e\u0432\u043e\u043b\u0435\u043d \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043d\u0430 ElasticSearch \u044d\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb.<\/p>\n<p>  Elastic \u043e\u0442\u043a\u0440\u044b\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443, \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 (\u043f\u043e \u0434\u0430\u0442\u0430\u043c, \u0442\u0438\u043f\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0438 \u0442.\u0434.)<\/p>\n<p>  \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u0435\u0449\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0443\u0431, \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. \u0422\u043e\u0442 \u0444\u0438\u0434\u0431\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Elastic \u0438 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0433\u043e\u0442\u043e\u0432 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c, \u0431\u0443\u0434\u0443 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0434.<\/p>\n<p>  MongoDB \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0437\u0430\u0434\u044b\u0448\u0430\u043b\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e, Locked % \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0.1% \u0438 \u043d\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u044b\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 MongoDB Full Text, \u0442\u043e \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0441 \u043d\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a ElasticSeach.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/likeastore\/blog\/223109\/\"> http:\/\/habrahabr.ru\/company\/likeastore\/blog\/223109\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c <a href=\"http:\/\/habrahabr.ru\/company\/likeastore\/blog\/222515\/\">\u043f\u043e\u0441\u0442\u0435<\/a>, \u0441 \u0430\u043d\u043e\u043d\u0441\u043e\u043c Google Chrome \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f <a href=\"https:\/\/likeastore.com\">Likeastore<\/a>, \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/elasticsearch.com\">ElasticSeach<\/a>. \u0418\u043c\u0435\u043d\u043d\u043e ElasticSeach \u0434\u0430\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043a \u0445\u0440\u043e\u043c\u0443.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u043a\u0438 MongoDB + ElasticSeach, \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 NoSQL \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 ElasticSearch, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c MongoDB.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-223109","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/223109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223109"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/223109\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}