{"id":252395,"date":"2015-03-04T12:56:04","date_gmt":"2015-03-04T08:56:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=252395"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=252395","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Elasticsearch"},"content":{"rendered":"<p>     \tElaticsearch \u2014 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 NoSQL \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u043e\u0438\u0441\u043a\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0442\u0435\u0441\u0442\u044b \u043a \u043d\u0435\u043c\u0443.<img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/26d\/bb1\/c9a\/26dbb1c9aadb454bb6f365e0cce707e9.png\"\/><a name=\"habracut\"><\/a>\u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0447\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u0442\u044c \u043a\u043e\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041d\u043e \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u043a\u043e\u043c\u043c\u0438\u0442\u0435\u0440\u043e\u043c Elasticsearch, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0432 \u0447\u0435\u043c-\u0442\u043e \u0431\u044b\u0442\u044c \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Event \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 start \u0438 stop, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u0432\u0440\u0435\u043c\u044f \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00abHH:MM:SS\u00bb. \u0417\u0430\u0434\u0430\u0447\u0430 \u2014 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 time \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (start &lt;= time &lt;= stop) \u0431\u044b\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u044b\u0434\u0430\u0447\u0438. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">{   &quot;start&quot;: &quot;09:00:00&quot;,   &quot;stop&quot;: &quot;18:30:00&quot; } <\/code><\/pre>\n<h4>\u041f\u043b\u0430\u0433\u0438\u043d<\/h4>\n<p>  \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u044f \u0432\u0437\u044f\u043b <a href=\"https:\/\/github.com\/imotov\/elasticsearch-native-script-example\">\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Elasticsearch<\/a>. \u041f\u043b\u0430\u0433\u0438\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"java\">public class ExamplePlugin extends AbstractPlugin {     public void onModule(ScriptModule module) {         module.registerScript(EventInProgressScript.SCRIPT_NAME, EventInProgressScript.Factory.class);     } } <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/main\/java\/me\/snov\/elasticsearch\/demo\/plugin\/ExamplePlugin.java\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/a><\/p>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u0444\u0430\u0431\u0440\u0438\u043a\u0430 NativeScriptFactory, \u0438 \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 AbstractSearchScript. \u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432). \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 1 \u0440\u0430\u0437 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 (\u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0440\u0434\u0435), \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435.<\/p>\n<p>  \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:  <\/p>\n<ul>\n<li>time \u2014 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00abHH:MM:SS\u00bb, \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442<\/li>\n<li>use_doc \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 (\u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435)<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"java\">public static class Factory implements NativeScriptFactory {     @Override     public ExecutableScript newScript(@Nullable Map&lt;String, Object&gt; params) {         LocalTime time = params.containsKey(PARAM_TIME)             ? new LocalTime(params.get(PARAM_TIME))             : null;         Boolean useDoc = params.containsKey(PARAM_USE_DOC)             ? (Boolean) params.get(PARAM_USE_DOC)             : null;          if (time == null || useDoc == null) {             throw new ScriptException(&quot;Parameters \\&quot;time\\&quot; and \\&quot;use_doc\\&quot; are required&quot;);         }          return new EventInProgressScript(time, useDoc);     } } <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/main\/java\/me\/snov\/elasticsearch\/demo\/script\/EventInProgressScript.java\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/a><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0438 \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u2014 \u043c\u0435\u0442\u043e\u0434 run():  <\/p>\n<pre><code class=\"java\">@Override public Integer run() {     Event event = useDoc         ? parser.getEvent(doc())         : parser.getEvent(source());      return event.isInProgress(time)         ? 1         : 0; } <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/main\/java\/me\/snov\/elasticsearch\/demo\/script\/EventInProgressScript.java\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/a><\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e. \u042d\u0442\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d\u0430.<\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u043e\u0439:  <\/p>\n<ol>\n<li>\u0427\u0438\u0442\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430<\/li>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/li>\n<li>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0432 Elasticsearch<\/li>\n<\/ol>\n<p>  \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 source(), fields(), \u0438\u043b\u0438 doc(). \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u043a\u0430\u0436\u0443 \u0447\u0442\u043e doc() \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 source() \u0438 \u043f\u0440\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.  <\/p>\n<pre><code class=\"java\">public class Event {     public static final String START = &quot;start&quot;;     public static final String STOP = &quot;stop&quot;;      private final LocalTime start;     private final LocalTime stop;      public Event(LocalTime start, LocalTime stop) {         this.start = start;         this.stop = stop;     }      public boolean isInProgress(LocalTime time) {         return (time.isEqual(start) || time.isAfter(start))             && (time.isBefore(stop) || time.isEqual(stop));     } } <\/code><\/pre>\n<p>  (\u0432 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0431\u044b\u0441\u0442\u0440\u0435\u0435)<\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u044d\u0442\u043e \u00ab1\u00bb \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0435\u0439\u0447\u0430\u0441 (start &lt;= time &lt;= stop), \u0438 \u00ab0\u00bb \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445. \u0422\u0438\u043f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u2014 Integer, \u0442.\u043a. \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e Boolean Elasticsearch \u043d\u0435 \u0443\u043c\u0435\u0435\u0442.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 Elasticsearch \u0438\u0445 \u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442. \u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430!<\/p>\n<h4>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/h4>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u0445\u043e\u0440\u043e\u0448\u0438 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435, \u044d\u0442\u043e \u0435\u0449\u0435 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438. \u041e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c breakpoint, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0433 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u0435\u0441\u044c\u043c\u0430 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0432\u0430:  <\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043c\u0430\u043f\u043f\u0438\u043d\u0433<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/li>\n<li>\u041f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430<\/li>\n<li>\u0423\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435<\/li>\n<\/ol>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c ElasticsearchIntegrationTest. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u043e\u0434, \u0448\u0430\u0440\u0434\u043e\u0432 \u0438 \u0440\u0435\u043f\u043b\u0438\u043a. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u2014 <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/test\/java\/me\/snov\/elasticsearch\/demo\/script\/AbstractScriptTest.java#L25-L52\">\u043d\u0430 GitHub<\/a>.<\/p>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0442\u0435\u0441\u0442\u0435 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/imotov\/elasticsearch-native-script-example\/blob\/master\/src\/test\/java\/org\/elasticsearch\/examples\/nativescript\/script\/IsPrimeSearchScriptTests.java#L29-L59\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0445\u043e\u0440\u043e\u0448, \u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0435\u0433\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b. \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0432 \u0442\u0435\u0441\u0442\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u0445\u0440\u0430\u043d\u0438\u0442\u044c <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/test\/resources\/mapping.json\">\u043c\u0430\u043f\u043f\u0438\u043d\u0433<\/a> \u0438 <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/test\/resources\/data.json\">\u0434\u0430\u043d\u043d\u044b\u0435<\/a> \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043d\u0430 \u0436\u0438\u0432\u044b\u0445 \u0441\u0435\u0440\u0435\u0432\u0435\u0440\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0442\u0435\u0441\u0442 \u0443\u043f\u0430\u0434\u0435\u0442. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043b\u044e\u0431\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0445\u043e\u0440\u043e\u0448, \u0432\u044b\u0431\u043e\u0440 \u0437\u0430 \u0432\u0430\u043c\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c Java-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c:  <\/p>\n<pre><code class=\"java\">SearchResponse searchResponse = client()     .prepareSearch(TEST_INDEX).setTypes(TEST_TYPE)     .addScriptField(scriptName, &quot;native&quot;, scriptName, scriptParams)     .execute()     .actionGet(); <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/test\/java\/me\/snov\/elasticsearch\/demo\/script\/AbstractScriptTest.java\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/a><\/p>\n<h5>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Travis-CI<\/h5>\n<p>  \u041d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u2014 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 <a href=\"https:\/\/travis-ci.org\/\">Continuous Integration \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 Travis<\/a>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/.travis.yml\">.travis<\/a>:  <\/p>\n<pre><code>language: java  jdk:   - openjdk7   - oraclejdk7  script:   - mvn test <\/code><\/pre>\n<p>\u0438 CI-\u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, <a href=\"https:\/\/travis-ci.org\/s12v\/elaticsearch-plugin-demo\">\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a<\/a>. \u041c\u0435\u043b\u043e\u0447\u044c, \u0430 \u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u043b\u0430\u0433\u0438\u043d \u0433\u043e\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0434\u0435\u043b\u0435.<\/p>\n<h5>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h5>\n<p>  \u041f\u0440\u043e \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/www.elasticsearch.org\/guide\/en\/elasticsearch\/reference\/current\/modules-plugins.html#installing\">\u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u0421\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 .\/target. \u0414\u043b\u044f \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e:   <\/p>\n<pre><code class=\"bash\">mvn clean package if [ $? -eq 0 ]; then \tplugin -r plugin-example \tplugin --install plugin-example --url file:\/\/`pwd`\/`ls target\/*.jar | head -n 1` \techo -e &quot;\\033[1;33mPlease restart Elasticsearch!\\033[0m&quot; fi <\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/src\/main\/java\/me\/snov\/elasticsearch\/demo\/script\/EventInProgressScript.java\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a><\/p>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f Mac\/brew. \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 plugin. \u0412 Ubuntu \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \/usr\/share\/elasticsearch\/bin\/plugin. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Elasticsearch.<\/p>\n<h5>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h5>\n<p>  <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\/blob\/master\/generator\/generate.rb\">\u041f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Ruby.  <\/p>\n<pre><code class=\"bash\">bundle install .\/generate.rb <\/code><\/pre>\n<h5>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/h5>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0441\u0438\u043c Elasticsearch \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u00abin_progress\u00bb:  <\/p>\n<pre><code class=\"bash\">curl -XGET &quot;http:\/\/localhost:9200\/demo\/event\/_search?pretty&quot; -d' {   &quot;sort&quot;: [     {         &quot;_script&quot;: {           &quot;script&quot;: &quot;in_progress&quot;,           &quot;params&quot;: {             &quot;time&quot;: &quot;15:20:00&quot;,             &quot;use_doc&quot;: true           },           &quot;lang&quot;: &quot;native&quot;,           &quot;type&quot;: &quot;number&quot;,           &quot;order&quot;: &quot;desc&quot;         }     }   ],  &quot;size&quot;: 1 }' <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:  <\/p>\n<pre><code class=\"javascript\">{   &quot;took&quot; : 139,   &quot;timed_out&quot; : false,   &quot;_shards&quot; : {     &quot;total&quot; : 2,     &quot;successful&quot; : 2,     &quot;failed&quot; : 0   },   &quot;hits&quot; : {     &quot;total&quot; : 86400,     &quot;max_score&quot; : null,     &quot;hits&quot; : [ {       &quot;_index&quot; : &quot;demo&quot;,       &quot;_type&quot; : &quot;event&quot;,       &quot;_id&quot; : &quot;AUvf6fPPoRWAbGdNya4y&quot;,       &quot;_score&quot; : null,       &quot;_source&quot;:{&quot;start&quot;:&quot;07:40:01&quot;,&quot;stop&quot;:&quot;15:20:02&quot;},       &quot;sort&quot; : [ 1.0 ]     } ]   } } <\/code><\/pre>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f 86400 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430 139 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e <br \/>  \u043d\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0441\u044f \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 (2 \u043c\u0441), \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0448\u0430\u0440\u0434\u0430\u0445 \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b source() \u0438 doc()<\/h4>\n<p>  \u041a\u0430\u043a \u044f \u043f\u0438\u0441\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0441\u043a\u0440\u0438\u043f\u0442\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. \u042d\u0442\u043e source(), fields(), \u0438 doc(). Source() \u2014 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431. \u041f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 <b>\u0432\u0441\u0435\u0433\u043e<\/b> \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 HashMap. \u041d\u043e \u0437\u0430\u0442\u043e \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0441\u0435. Doc() \u2014 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043e\u043d \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f Nested, \u0447\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0443\u0431\u0440\u0430\u0442\u044c \u00abindex\u00bb: \u00abnot_analyzed\u00bb \u0432 mapping.json, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0430 fields(), \u0442\u043e \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u044f \u0435\u0433\u043e \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u0441\u0443\u0434\u044f \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u043c \u043b\u0443\u0447\u0448\u0435 source().<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c source(), \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 use_doc \u043d\u0430 false.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">curl -XGET &quot;http:\/\/localhost:9200\/demo\/event\/_search?pretty&quot; -d' {   &quot;sort&quot;: [     {         &quot;_script&quot;: {           &quot;script&quot;: &quot;in_progress&quot;,           &quot;params&quot;: {             &quot;time&quot;: &quot;15:20:00&quot;,             &quot;use_doc&quot;: false           },           &quot;lang&quot;: &quot;native&quot;,           &quot;type&quot;: &quot;number&quot;,           &quot;order&quot;: &quot;desc&quot;         }     }   ],  &quot;size&quot;: 1 }' <\/code><\/pre>\n<\/div>\n<\/div>\n<p>\u0418 \u0432\u043e\u0442 \u0443\u0436\u0435 \u00abtook\u00bb: 587 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u0442.\u0435. \u0432 4 \u0440\u0430\u0437\u0430 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0441\u043e\u0442\u043d\u0438 \u0440\u0430\u0437.<\/p>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/h4>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438, \u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432 \u043b\u044e\u0431\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0433\u0434\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412 \u044d\u0442\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u0441\u0442\u0430\u0442\u0438, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438 \u043b\u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.  <\/p>\n<pre><code class=\"bash\">curl -XGET &quot;http:\/\/localhost:9200\/demo\/event\/_search&quot; -d' {   &quot;script_fields&quot;: {     &quot;in_progress&quot;: {       &quot;script&quot;: &quot;in_progress&quot;,       &quot;params&quot;: {         &quot;time&quot;: &quot;00:00:01&quot;,         &quot;use_doc&quot;: true       },       &quot;lang&quot;: &quot;native&quot;     }   },   &quot;partial_fields&quot;: {     &quot;properties&quot;: {       &quot;include&quot;: [&quot;*&quot;]     }   },    &quot;size&quot;: 1 }' <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">{    &quot;took&quot;: 2,    &quot;timed_out&quot;: false,    &quot;_shards&quot;: {       &quot;total&quot;: 2,       &quot;successful&quot;: 2,       &quot;failed&quot;: 0    },    &quot;hits&quot;: {       &quot;total&quot;: 86400,       &quot;max_score&quot;: 1,       &quot;hits&quot;: [          {             &quot;_index&quot;: &quot;demo&quot;,             &quot;_type&quot;: &quot;event&quot;,             &quot;_id&quot;: &quot;AUvf6fO9oRWAbGdNyUJi&quot;,             &quot;_score&quot;: 1,             &quot;fields&quot;: {                &quot;in_progress&quot;: [                   1                ],                &quot;properties&quot;: [                   {                      &quot;stop&quot;: &quot;00:00:02&quot;,                      &quot;start&quot;: &quot;00:00:01&quot;                   }                ]             }          }       ]    } } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438!<br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/s12v\/elaticsearch-plugin-demo\">github.com\/s12v\/elaticsearch-plugin-demo<\/a><\/p>\n<p>  P.S. \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u044b \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0438 \u0441\u0438\u0441\u0430\u0434\u043c\u0438\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 AWS\/Elasticsearch\/Symfony2 \u0432 \u0411\u0435\u0440\u043b\u0438\u043d\u0435. \u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u043f\u0438\u0448\u0438\u0442\u0435!      \t<\/p>\n<div class=\"clear\"><\/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\/post\/252067\/\"> http:\/\/habrahabr.ru\/post\/252067\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \tElaticsearch \u2014 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 NoSQL \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u043e\u0438\u0441\u043a\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0442\u0435\u0441\u0442\u044b \u043a \u043d\u0435\u043c\u0443.<img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/26d\/bb1\/c9a\/26dbb1c9aadb454bb6f365e0cce707e9.png\"\/><\/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-252395","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/252395","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=252395"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/252395\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}