diff --git a/lib/models/BaseAsset.ts b/lib/models/BaseAsset.ts index 9c512cce..2e38036c 100644 --- a/lib/models/BaseAsset.ts +++ b/lib/models/BaseAsset.ts @@ -20,12 +20,27 @@ export class BaseAsset { } } -export const assetsMappings ={ +export const assetsMappings = { dynamic: 'strict', properties: { - type: { type: 'keyword' }, - model: { type: 'keyword' }, - reference: { type: 'keyword' }, + type: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, measures: { properties: { // autogenerated from devices mappings diff --git a/lib/models/Device.ts b/lib/models/Device.ts index a6cb5766..c100eb97 100644 --- a/lib/models/Device.ts +++ b/lib/models/Device.ts @@ -12,7 +12,7 @@ export class Device { this._source = { qos: {}, metadata: {}, - ...content, + ...content }; } @@ -27,24 +27,44 @@ export class Device { export const devicesMappings = { dynamic: 'strict', properties: { - reference: { type: 'keyword' }, - model: { type: 'keyword' }, + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, measures: { properties: { temperature: { properties: { // common updatedAt: { type: 'date' }, - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, // temperature - degree: { type: 'float' }, + degree: { type: 'float' } } }, position: { properties: { // common updatedAt: { type: 'date' }, - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, // position point: { type: 'geo_point' }, altitude: { type: 'float' }, @@ -54,23 +74,38 @@ export const devicesMappings = { movement: { properties: { // common - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, updatedAt: { type: 'date' }, // movement state moving: { type: 'boolean' }, } - }, + } } }, qos: { dynamic: 'false', - properties: {} + properties: {}, }, metadata: { dynamic: 'false', - properties: {} + properties: {}, + }, + assetId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } }, - assetId: { type: 'keyword' }, - tenantId: { type: 'keyword' } + tenantId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + } } };