KNOX-1155 - Knox Gateway Service for ElasticSearch (Dequan Chen via lmccay)
diff --git a/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/rewrite.xml b/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/rewrite.xml
new file mode 100644
index 0000000..f99fd27
--- /dev/null
+++ b/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/rewrite.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<rules>
+    <rule dir="IN" name="ELASTICSEARCH/elasticsearch/inbound/root" pattern="*://*:*/**/elasticsearch/">
+        <rewrite template="{$serviceUrl[ELASTICSEARCH]}/"/>
+    </rule>
+    <rule dir="IN" name="ELASTICSEARCH/elasticsearch/inbound/path" pattern="*://*:*/**/elasticsearch/{path=**}?{**}">
+        <rewrite template="{$serviceUrl[ELASTICSEARCH]}/{path=**}?{**}"/>
+    </rule>
+</rules>
diff --git a/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/service.xml b/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/service.xml
new file mode 100644
index 0000000..fdf5603
--- /dev/null
+++ b/gateway-service-definitions/src/main/resources/services/elasticsearch/1.0.0/service.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<service role="ELASTICSEARCH" name="elasticsearch" version="1.0.0">
+    <policies>
+        <policy role="webappsec"/>
+        <policy role="authentication" name="Anonymous"/>
+        <policy role="rewrite"/>
+    </policies>
+    <routes>
+        <route path="/elasticsearch"/>
+        <route path="/elasticsearch/**"/>
+    </routes>
+    <dispatch classname="org.apache.hadoop.gateway.dispatch.PassAllHeadersDispatch"/>
+</service>