src/core/domain/dtos/es-response.dto.ts
Elasticsearch response DTO
Properties |
_shards |
Type : object
|
Decorators :
@IsOptional()
|
Defined in src/core/domain/dtos/es-response.dto.ts:54
|
Contains a number of Elasticsearch shards used for the request |
hits |
Type : object
|
Decorators :
@IsOptional()
|
Defined in src/core/domain/dtos/es-response.dto.ts:82
|
Contains returned documents and metadata |
timed_out |
Type : boolean
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/es-response.dto.ts:37
|
Status of the request If 'true' - the request timed out before completion |
took |
Type : number
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/es-response.dto.ts:24
|
Number of milliseconds it took Elasticsearch to execute the request |
import { ApiProperty } from "@nestjs/swagger";
import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional } from "class-validator";
/**
* List of allowed properties in this DTO
*/
const allowedProperties = ['took', 'timed_out', '_shards', 'hits'];
/**
* Elasticsearch response DTO
*/
export class EsResponseDto {
/**
* Number of milliseconds it
* took Elasticsearch to execute the request
*/
@IsDefined()
@IsNotEmpty()
@IsNumber()
@ApiProperty({
description: 'took',
example: 5
})
took: number;
/**
* Status of the request
* If 'true' - the request timed out before completion
*/
@IsDefined()
@IsNotEmpty()
@IsBoolean()
@ApiProperty({
description: 'timed_out',
example: false,
})
timed_out: boolean;
/**
* Contains a number of Elasticsearch shards
* used for the request
*/
@IsOptional()
@IsObject()
@ApiProperty({
description: '_shards',
example: {
total: 1,
successful: 1,
skipped: 0,
failed: 0,
}
})
_shards: object;
/**
* Contains returned documents and metadata
*/
@IsOptional()
@IsObject()
@ApiProperty({
description: 'hits',
example: {
total: {
value: 3,
relation: 'eq'
},
max_score: 1.2,
hits: [{
_index: 'papers',
_id: '01002',
_score: 1.2,
_source: {
},
fields: {
}
}],
}
})
hits: object;
}