From 09680a88d86bb9c1aafcce8eadae66b006da2093 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Thu, 2 Jul 2015 13:08:29 +0300
Subject: [PATCH] Add indices query doc.

---
 docs/Query/Indices.md | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 docs/Query/Indices.md

diff --git a/docs/Query/Indices.md b/docs/Query/Indices.md
new file mode 100644
index 0000000..f02c001
--- /dev/null
+++ b/docs/Query/Indices.md
@@ -0,0 +1,39 @@
+# Indices Query
+
+> More info about indices query is in the [official elasticsearch docs][1]
+
+The indices query can be used when executed across multiple indices, allowing to have a query that executes
+only when executed on an index that matches a specific list of indices, and another query that executes
+when it is executed on an index that does not match the listed indices.
+
+## Simple example
+
+```JSON
+{
+    "indices" : {
+        "indices" : ["index1", "index2"],
+        "query" : {
+            "term" : { "tag" : "wow" }
+        },
+        "no_match_query" : {
+            "term" : { "tag" : "kow" }
+        }
+    }
+}
+```
+
+In DSL:
+
+```php
+$matchTermQuery = new TermQuery('tag', 'wow');
+$noMatchTermQuery = new TermQuery('tag', 'kow');
+
+$indicesQuery = new IndicesQuery(['index1', 'index2'], $matchTermQuery, $noMatchTermQuery);
+
+$search = new Search();
+$search->addQuery($indicesQuery);
+
+$queryArray = $search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-indices-query.html
-- 
GitLab