How to use new elasticsearch typescript types

I want to use new elastic search types as per this TypeScript support | Elasticsearch Node.js client [7.x] | Elastic document but if I do

// try the new code completion when building a query!
const response = await client.search<Source>({
  index: 'test',
  body: {
    query: {
      match_all: {}
    }
  }
})

// try the new code completion when traversing a response!
const results = response.body.hits.hits.map(hit => hit._source)
// results type will be `Source[]`
console.log(results)

my results object itself coming as type I have provided and not coming as SearchResponse

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.