11import { JSONObject } from './JSONObject' ;
22
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 = {
108 /**
119 * Dynamic mapping policy
1210 *
1311 * @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-dynamic-policy
1412 */
15- dynamic ?: 'true' | 'false' | 'strict'
13+ dynamic ?: 'true' | 'false' | 'strict' ;
1614}
1715
16+ type PropertyType = {
17+ [ name : string ] : { type ?: string ; } | PropertyObject | JSONObject
18+ }
19+
20+ export type MappingsProperties = PropertyObject | PropertyDynamic | PropertyType ;
21+
1822/**
1923 * Collection mappings definition
2024 *
2125 * @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+ * ```
2240 */
2341export type CollectionMappings = {
2442 /**
@@ -27,16 +45,18 @@ export type CollectionMappings = {
2745 * @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-metadata
2846 */
2947 _meta ?: JSONObject ;
48+
3049 /**
3150 * Properties types definition
3251 *
3352 * @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-properties
3453 */
35- properties ?: MappingsProperties ,
54+ properties ?: MappingsProperties ;
55+
3656 /**
3757 * Dynamic mapping policy
3858 *
3959 * @see https://docs.kuzzle.io/core/2/guides/main-concepts/data-storage/#mappings-dynamic-polic
4060 */
41- dynamic ?: 'true' | 'false' | 'strict' ,
61+ dynamic ?: 'true' | 'false' | 'strict' ;
4262}
0 commit comments