Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Следующая версия
Предыдущая версия
system:elasticsearch:exaples:example-6 [2018/10/29 12:20] – создано mirocowsystem:elasticsearch:exaples:example-6 [2019/07/15 19:17] (текущий) mirocow
Строка 1: Строка 1:
-====== IN equivalent operator in ElasticSearch ======+{{tag>search indexer elasticsearch indexer}}
  
 +====== How use IN equivalent operator in ElasticSearch? ======
 +
 +<code sql>SELECT * FROM table WHERE id IN (1, 2, 3);</code>
 +
 +The equivalent Elasticsearch 1.x filter would be:
 +
 +<code json>{
 +  "query" : {
 +    "filtered" : {
 +      "filter" : {
 +        "terms" : {
 +          "id" : [1, 2, 3]
 +        }
 +      }
 +    }
 +  }
 +}</code>
 +
 +
 +The equivalent Elasticsearch 2.x+ filter would be:
 +
 +<code json>{
 +  "query" : {
 +    "bool" : {
 +      "filter" : {
 +        "terms" : {
 +          "id" : [1, 2, 3]
 +        }
 +      }
 +    }
 +  }
 +}</code>