File tree Expand file tree Collapse file tree 2 files changed +50
-8
lines changed
src/sdk-reference/js/6/collection/get-mapping Expand file tree Collapse file tree 2 files changed +50
-8
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,31 @@ Additional query options
3434
3535Resolves 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]
Original file line number Diff line number Diff line change 11try {
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+ }
You can’t perform that action at this time.
0 commit comments