diff --git a/doc/3/controllers/collection/get-mapping/index.md b/doc/3/controllers/collection/get-mapping/index.md
new file mode 100644
index 00000000..e38a7371
--- /dev/null
+++ b/doc/3/controllers/collection/get-mapping/index.md
@@ -0,0 +1,33 @@
+---
+code: true
+type: page
+title: getMapping
+description: Return collection mapping
+---
+
+# getMapping
+
+Returns the collection mapping.
+
+
+
+```java
+public CompletableFuture> getMapping(
+ final String index,
+ final String collection) throws NotConnectedException, InternalException
+```
+
+
+
+| Arguments | Type | Description |
+| ------------ | ----------------- | --------------- |
+| `index` | String
| Index name |
+| `collection` | String
| Collection name |
+
+## Returns
+
+Returns a `ConcurrentHashMap` representing the collection mapping.
+
+## Usage
+
+<<< ./snippets/get-mapping.js
\ No newline at end of file
diff --git a/doc/3/controllers/collection/get-mapping/snippets/get-mapping.java b/doc/3/controllers/collection/get-mapping/snippets/get-mapping.java
new file mode 100644
index 00000000..bef31262
--- /dev/null
+++ b/doc/3/controllers/collection/get-mapping/snippets/get-mapping.java
@@ -0,0 +1,25 @@
+ConcurrentHashMap result = kuzzle
+ .getCollectionController()
+ .getMapping("nyc-open-data", "yellow-taxi")
+ .get();
+
+/*
+{
+ _meta={
+ schema={},
+ allowForm=false
+ },
+ dynamic=true,
+ properties={
+ key={
+ type=text,
+ fields={
+ keyword={
+ ignore_above=256,
+ type=keyword
+ }
+ }
+ }
+ }
+ }
+*/
\ No newline at end of file
diff --git a/doc/3/controllers/collection/get-mapping/snippets/get-mapping.test.yml b/doc/3/controllers/collection/get-mapping/snippets/get-mapping.test.yml
new file mode 100644
index 00000000..e8f34817
--- /dev/null
+++ b/doc/3/controllers/collection/get-mapping/snippets/get-mapping.test.yml
@@ -0,0 +1,7 @@
+name: collection#getMapping
+description: Return collection mapping
+hooks:
+ before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi
+ after:
+template: print-result
+expected: "true"
\ No newline at end of file
diff --git a/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java b/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
index 23dada9f..cdf96dbe 100644
--- a/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
+++ b/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
@@ -6,6 +6,7 @@
import io.kuzzle.sdk.Kuzzle;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
public class CollectionController extends BaseController {
@@ -38,4 +39,30 @@ public CompletableFuture exists(
.thenApplyAsync(
(response) -> (Boolean) response.result);
}
+
+ /**
+ * Get collection mapping
+ *
+ * @param index
+ * @param collection
+ * @return a CompletableFuture
+ * @throws NotConnectedException
+ * @throws InternalException
+ */
+ public CompletableFuture> getMapping(
+ final String index,
+ final String collection) throws NotConnectedException, InternalException {
+
+ final KuzzleMap query = new KuzzleMap();
+ query
+ .put("index", index)
+ .put("collection", collection)
+ .put("controller", "collection")
+ .put("action", "getMapping");
+
+ return kuzzle
+ .query(query)
+ .thenApplyAsync(
+ (response) -> (ConcurrentHashMap) response.result);
+ }
}
diff --git a/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java b/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
index 0f82e7f0..99523b49 100644
--- a/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
+++ b/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
@@ -49,4 +49,35 @@ public void existsCollectionShouldThrowWhenNotConnected() throws NotConnectedExc
kuzzleMock.getCollectionController().exists(index, collection);
}
+
+ @Test
+ public void getMappingCollectionTest() throws NotConnectedException, InternalException {
+
+ Kuzzle kuzzleMock = spy(new Kuzzle(networkProtocol));
+ String index = "nyc-open-data";
+ String collection = "yellow-taxi";
+
+
+ ArgumentCaptor arg = ArgumentCaptor.forClass(KuzzleMap.class);
+
+ kuzzleMock.getCollectionController().getMapping(index, collection);
+ Mockito.verify(kuzzleMock, Mockito.times(1)).query(arg.capture());
+
+ assertEquals((arg.getValue()).getString("controller"), "collection");
+ assertEquals((arg.getValue()).getString("action"), "getMapping");
+ assertEquals((arg.getValue()).getString("index"), "nyc-open-data");
+ assertEquals((arg.getValue()).getString("collection"), "yellow-taxi");
+ }
+
+ @Test(expected = NotConnectedException.class)
+ public void getMappingShouldThrowWhenNotConnected() throws NotConnectedException, InternalException {
+ AbstractProtocol fakeNetworkProtocol = Mockito.mock(WebSocket.class);
+ Mockito.when(fakeNetworkProtocol.getState()).thenAnswer((Answer) invocation -> ProtocolState.CLOSE);
+
+ Kuzzle kuzzleMock = spy(new Kuzzle(fakeNetworkProtocol));
+ String index = "nyc-open-data";
+ String collection = "yellow-taxi";
+
+ kuzzleMock.getCollectionController().getMapping(index, collection);
+ }
}