@@ -2,12 +2,7 @@ import { getElasticsearchClient } from '@/search/lib/helpers/get-client'
22import { DEFAULT_HIGHLIGHT_FIELDS } from '@/search/lib/search-request-params/search-params-objects'
33import { getHighlightConfiguration } from '@/search/lib/get-elasticsearch-results/helpers/elasticsearch-highlight-config'
44
5- import type {
6- SearchHit as ElasticsearchHit ,
7- QueryDslQueryContainer ,
8- SearchRequest ,
9- SearchTotalHits ,
10- } from '@elastic/elasticsearch/lib/api/types'
5+ import type { estypes } from '@elastic/elasticsearch'
116import type {
127 AdditionalIncludes ,
138 ComputedSearchQueryParamsMap ,
@@ -122,7 +117,7 @@ export async function getGeneralSearchResults(
122117
123118 const aggs = getAggregations ( aggregate )
124119
125- const searchQuery : SearchRequest = {
120+ const searchQuery : estypes . SearchRequest = {
126121 index : indexName ,
127122 highlight,
128123 from,
@@ -198,7 +193,7 @@ export async function getGeneralSearchResults(
198193 const t1 = Date . now ( )
199194
200195 const meta = {
201- found : hitsAll . total as SearchTotalHits ,
196+ found : hitsAll . total as estypes . SearchTotalHits ,
202197 took : {
203198 query_msec : result . took ,
204199 total_msec : t1 - t0 ,
@@ -255,7 +250,7 @@ interface GetMatchQueriesOptions {
255250function getMatchQueries (
256251 query : string ,
257252 { usePrefixSearch, fuzzy } : GetMatchQueriesOptions ,
258- ) : QueryDslQueryContainer [ ] {
253+ ) : estypes . QueryDslQueryContainer [ ] {
259254 const BOOST_PHRASE = 10.0
260255 const BOOST_TITLE = 4.0
261256 const BOOST_HEADINGS = 3.0
@@ -268,7 +263,7 @@ function getMatchQueries(
268263 // which wouldn't find anything else anyway.
269264 const BOOST_FUZZY = 0.1
270265
271- const matchQueries : QueryDslQueryContainer [ ] = [ ]
266+ const matchQueries : estypes . QueryDslQueryContainer [ ] = [ ]
272267
273268 // If the query input is multiple words, it's good to know because you can
274269 // make the query do `match_phrase` and you can make `match` query
@@ -452,7 +447,7 @@ interface GetHitsOptions {
452447}
453448
454449function getHits (
455- hits : ElasticsearchHit < any > [ ] ,
450+ hits : estypes . SearchHit < any > [ ] ,
456451 { indexName, debug = false , includeTopics = false , highlightFields, include } : GetHitsOptions ,
457452) : GeneralSearchHit [ ] {
458453 return hits . map ( ( hit ) => {
@@ -470,7 +465,7 @@ function getHits(
470465 }
471466
472467 const result : GeneralSearchHit = {
473- id : hit . _id ,
468+ id : hit . _id ! ,
474469 url : hit . _source . url ,
475470 title : hit . _source . title ,
476471 breadcrumbs : hit . _source . breadcrumbs ,
0 commit comments