File

src/core/domain/dtos/es-hit.dto.ts

Description

Structure of the document stored and retrieved from Elasticsearch

Index

Properties

Properties

Optional _score
Type : number
Decorators :
@IsOptional()
@ApiProperty({description: 'Relevance score', example: 1.2355})

Hit relevance score

_source
Type : PaperDto
Decorators :
@IsNotEmpty()
@ApiProperty({description: 'Actual document (paper) stored in Elasticsearch', example: undefined})

Actual document stored in Elasticsearch

Optional sort
Type : []
Decorators :
@IsOptional()
@ApiProperty({description: 'List of objects that represents how the hit was sorted', example: undefined})

List of objects that represents how the hit was sorted

import { ApiProperty } from "@nestjs/swagger";
import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { PaperDto } from "./paper.dto";

/**
 * List of allowed properties in this DTO
 */
const allowedProperties = ['sort', '_source', '_score'];

/**
 * Structure of the document stored and retrieved from Elasticsearch
 */
export class EsHitDto {
    /**
     * Actual document stored in Elasticsearch
     */
    @IsNotEmpty()
    @ApiProperty({
        description: 'Actual document (paper) stored in Elasticsearch',
        example: {
            id: 'sssss'
        }
    })
    _source: PaperDto;
    
    /**
     * List of objects that represents how the hit was sorted
     */
    @IsOptional()
    @ApiProperty({
        description: 'List of objects that represents how the hit was sorted',
        example: {}
    })
    sort?: [];

    /**
     * Hit relevance score
     */
    @IsOptional()
    @ApiProperty({
        description: 'Relevance score',
        example: 1.2355
    })
    _score?: number;
}

results matching ""

    No results matching ""