### File

`src/core/domain/dtos/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: '_shards', example: undefined})`
Defined in src/core/domain/dtos/es-response.dto.ts:55
Contains a number of Elasticsearch shards used for the request

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

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

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

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

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

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

    /**
     * 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: EsResponseHits;

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

# results matching ""

# No results matching ""