Fixed return format of the search results

This commit is contained in:
danny-mhlv 2022-08-16 17:19:44 +03:00
parent da564323a0
commit a645498658

View File

@ -2,6 +2,7 @@ import { HttpService } from "@nestjs/axios";
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
import { Observable, map, take } from "rxjs";
import { PageDto } from "../domain/dtos";
import { EsHitDto } from "../domain/dtos/es-hit.dto";
import { EsQueryDto } from "../domain/dtos/es-query.dto";
import { RequestDto } from "../domain/dtos/request.dto";
import { SearchQueryDto } from "../domain/dtos/search-q.dto";
@ -135,6 +136,9 @@ export class PageInterceptor implements NestInterceptor {
reverse = false;
}
// Omitting the redundant info and leaving only the document
data = data.map((el) => el._source);
// Return the page
return new PageDto(data, meta);
})