### File

`src/core/domain/dtos/elastic/es-response.dto.ts`

### Description

Elasticsearch response DTO

### Index

###### Properties

- _shards
- hits
- Optional pit_id
- timed_out
- took

### Properties

_shards
Type : `object`
Decorators : `@IsOptional() @IsObject() @ApiProperty({description: 'Contains a count of Elasticsearch shards used to process the request', example: undefined})`
Defined in src/core/domain/dtos/elastic/es-response.dto.ts:56
Contains a number of Elasticsearch shards used for the request

hits
Type : `EsResponseHits`
Decorators : `@IsOptional() @IsObject() @ApiProperty({description: 'Contains returned documents and metadata', example: undefined})`
Defined in src/core/domain/dtos/elastic/es-response.dto.ts:80
Contains returned documents and metadata

Optional pit_id
Type : `string`
Decorators : `@IsString() @IsOptional() @ApiPropertyOptional({description: 'Contains PIT ID used to search for results', example: '46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=='})`
Defined in src/core/domain/dtos/elastic/es-response.dto.ts:91
ID of the PIT used in the search

timed_out
Type : `boolean`
Decorators : `@IsDefined() @IsNotEmpty() @IsBoolean() @ApiProperty({description: 'Shows if request timed out before completion', example: false})`
Defined in src/core/domain/dtos/elastic/es-response.dto.ts:39
Status of the request If 'true' - the request timed out before completion

took
Type : `number`
Decorators : `@IsDefined() @IsNotEmpty() @IsNumber() @ApiProperty({description: 'The time that it took Elasticsearch to process the query', example: 5})`
Defined in src/core/domain/dtos/elastic/es-response.dto.ts:26
Number of milliseconds it took Elasticsearch to execute the request

    import { ApiExtraModels, ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
    import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional, IsString } from "class-validator";
    import { EsResponseHits } from "../../interfaces/elastic/es-response-hits.interface";

    /**
     * List of allowed properties in this DTO
     */
    const allowedProperties = ['took', 'timed_out', '_shards', 'hits', 'pit_id'];

    /**
     * Elasticsearch response DTO
     */
    @ApiExtraModels()
    export class EsResponseDto {
        /**
         * Number of milliseconds it
         * took Elasticsearch to execute the request
         */
        @IsDefined()
        @IsNotEmpty()
        @IsNumber()
        @ApiProperty({
            description: 'The time that it took Elasticsearch to process the query',
            example: 5
        })
        took: number;

        /**
         * Status of the request
         * If 'true' - the request timed out before completion
         */
        @IsDefined()
        @IsNotEmpty()
        @IsBoolean()
        @ApiProperty({
            description: 'Shows if request timed out before completion',
            example: false,
        })
        timed_out: boolean;

        /**
         * Contains a number of Elasticsearch shards
         * used for the request
         */
        @IsOptional()
        @IsObject()
        @ApiProperty({
            description: 'Contains a count of Elasticsearch shards used to process the request',
            example: {
                total: 1,
                successful: 1,
                skipped: 0,
                failed: 0,
            }
        })
        _shards: object;

        /**
         * Contains returned documents and metadata
         */
        @IsOptional()
        @IsObject()
        @ApiProperty({
            description: 'Contains returned documents and metadata',
            example: {
                total: {
                    value: 3,
                    relation: 'eq'
                },
                max_score: 1.2,
                hits: [{
                    _index: 'papers',
                    _id: '01002',
                    _score: 1.2,
                    _source: {},
                    fields: {}
                }],
            }
        })
        hits: EsResponseHits;

        /**
         * ID of the PIT used in the search
         */
        @IsString()
        @IsOptional()
        @ApiPropertyOptional({
            description: 'Contains PIT ID used to search for results',
            example: '46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=='
        })
        pit_id?: string;
    }

# results matching ""

# No results matching ""