Skip to content

Commit

Permalink
Cleaning PassiveSearch API response
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan812 committed Nov 5, 2023
1 parent 067cc92 commit a2ff5a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/searchtools/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export async function passiveSearch(query: string): Promise<any> {
}
const result = await esClient.search({
index: 'openapi',
filterPath : ['hits.hits._source'],
body: {
query: {
simple_query_string: {
Expand All @@ -92,7 +93,7 @@ export async function passiveSearch(query: string): Promise<any> {
if (result.hits.hits.length === 0) {
console.error('No results found in the database');
}
return result.hits.hits;
return result.hits.hits.map((hit: any) => hit._source);
}
} catch (error) {
if (error.message.includes('No Living connections')) {
Expand Down

0 comments on commit a2ff5a0

Please sign in to comment.