From a9fb94724dd496f378563bb58873c30f6743ae03 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Tue, 7 Jul 2015 13:34:02 +0300
Subject: [PATCH] Add geo shape filter doc.

---
 docs/Filter/GeoShape.md | 86 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 docs/Filter/GeoShape.md

diff --git a/docs/Filter/GeoShape.md b/docs/Filter/GeoShape.md
new file mode 100644
index 0000000..e44d816
--- /dev/null
+++ b/docs/Filter/GeoShape.md
@@ -0,0 +1,86 @@
+# Geo Shape Filter
+
+> More info about geo shape filter is in the [official elasticsearch docs][1]
+
+Filter documents indexed using the geo shape type.
+
+## Simple example
+
+```JSON
+{
+    "query":{
+        "filtered": {
+            "query": {
+                "match_all": {}
+            },
+            "filter": {
+                "geo_shape": {
+                    "location": {
+                        "shape": {
+                            "type": "envelope",
+                            "coordinates" : [[13.0, 53.0], [14.0, 52.0]]
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+```
+
+And now the query via DSL:
+
+```php
+$geoShapeFilter = new GeoShapeFilter();
+$geoShapeFilter->addShape('location', 'envelope', [[13.0, 53.0], [14.0, 52.0]]);
+
+$search = new Search();
+$search->addFilter($geoShapeFilter);
+
+$queryArray = $search->toArray();
+```
+
+## Pre Indexed Shape
+
+```JSON
+{
+    "filtered": {
+        "query": {
+            "match_all": {}
+        },
+        "filter": {
+            "geo_shape": {
+                "location": {
+                    "indexed_shape": {
+                        "id": "DEU",
+                        "type": "countries",
+                        "index": "shapes",
+                        "path": "location"
+                    }
+                }
+            }
+        }
+    }
+}
+```
+
+And now the query via DSL:
+
+```php
+$geoShapeFilter = new GeoShapeFilter();
+$geoShapeFilter->addPreIndexedShape(
+    'location',
+    'DEU',
+    'countries',
+    'shapes',
+    'location'
+);
+
+$search = new Search();
+$search->addFilter($geoShapeFilter);
+
+$queryArray = $search->toArray();
+```
+
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-filter.html
-- 
GitLab