1
1
import { JSONObject } from './JSONObject' ;
2
2
3
- export type MappingsProperties = {
4
- /**
5
- * Properties types definition
6
- *
7
- * @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-properties
8
- */
9
- properties ?: MappingsProperties | JSONObject ,
3
+ type PropertyObject = {
4
+ properties ?: MappingsProperties ;
5
+ }
6
+
7
+ type PropertyDynamic = {
10
8
/**
11
9
* Dynamic mapping policy
12
10
*
13
11
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-dynamic-policy
14
12
*/
15
- dynamic ?: 'true' | 'false' | 'strict'
13
+ dynamic ?: 'true' | 'false' | 'strict' ;
16
14
}
17
15
16
+ type PropertyType = {
17
+ [ name : string ] : { type ?: string ; } | PropertyObject | JSONObject
18
+ }
19
+
20
+ export type MappingsProperties = PropertyObject | PropertyDynamic | PropertyType ;
21
+
18
22
/**
19
23
* Collection mappings definition
20
24
*
21
25
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#collection-mappings
26
+ *
27
+ * @example
28
+ * ```
29
+ * {
30
+ * properties: {
31
+ * name: { type: 'keyword' },
32
+ * address: {
33
+ * properties: {
34
+ * zipcode: { type: 'integer' }
35
+ * }
36
+ * }
37
+ * }
38
+ * }
39
+ * ```
22
40
*/
23
41
export type CollectionMappings = {
24
42
/**
@@ -27,16 +45,18 @@ export type CollectionMappings = {
27
45
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-metadata
28
46
*/
29
47
_meta ?: JSONObject ;
48
+
30
49
/**
31
50
* Properties types definition
32
51
*
33
52
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-properties
34
53
*/
35
- properties ?: MappingsProperties ,
54
+ properties ?: MappingsProperties ;
55
+
36
56
/**
37
57
* Dynamic mapping policy
38
58
*
39
59
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-dynamic-polic
40
60
*/
41
- dynamic ?: 'true' | 'false' | 'strict' ,
61
+ dynamic ?: 'true' | 'false' | 'strict' ;
42
62
}
0 commit comments