Fixed return format of the search results
This commit is contained in:
parent
da564323a0
commit
a645498658
@ -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);
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user