Skip to content

Commit 33d6078

Browse files
authored
doc: disambiguation of getMapping sample response in JS SDK (#280)
Disambiguate `getMapping` sample response in JS 6 SDK documentation.
1 parent d10340b commit 33d6078

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

src/sdk-reference/js/6/collection/get-mapping/index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,31 @@ Additional query options
3434

3535
Resolves to an `object` representing the collection mapping.
3636

37+
Example :
38+
```js
39+
{
40+
"<index>": { // The provided <index>
41+
"mappings": {
42+
"<collection>": { // The provided <collection>
43+
// The actual mapping of the collection starts here:
44+
"properties": {
45+
"field1": {
46+
"type": "integer"
47+
},
48+
"field2": {
49+
"type": "keyword"
50+
},
51+
"field3": {
52+
"type": "date",
53+
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
```
61+
3762
## Usage
3863

3964
[snippet=get-mapping]
Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
try {
22
const mapping = await kuzzle.collection.getMapping('nyc-open-data', 'yellow-taxi');
33
console.log(mapping);
4+
45
/*
5-
{
6-
properties: {
7-
license: { type: 'keyword' },
8-
driver: {
9-
properties: {
10-
name: { type: 'keyword' },
11-
curriculum: { type: 'text' }
6+
{
7+
"nyc-open-data": {
8+
"mappings": {
9+
"yellow-taxi": {
10+
"dynamic": "false",
11+
"_meta": {
12+
"area": "Panipokhari"
13+
},
14+
"properties": {
15+
"license": {
16+
"type": "keyword"
17+
},
18+
"driver": {
19+
"properties": {
20+
"name": {
21+
"type": "keyword"
22+
},
23+
"curriculum": {
24+
"type": "text"
25+
}
26+
}
27+
}
1228
}
1329
}
1430
}
1531
}
32+
}
1633
*/
1734

1835
console.log('Success');
1936
} catch (error) {
2037
console.error(error.message);
21-
}
38+
}

0 commit comments

Comments
 (0)