Skip to content

Instantly share code, notes, and snippets.

@mchelen
Last active May 29, 2018 15:10
Show Gist options
  • Select an option

  • Save mchelen/82096b9711c9689b573a312d45090233 to your computer and use it in GitHub Desktop.

Select an option

Save mchelen/82096b9711c9689b573a312d45090233 to your computer and use it in GitHub Desktop.
import { Get, Controller } from '@nestjs/common';
import elasticsearch = require('elasticsearch');
@Controller('search')
export class SearchController {
@Get()
async doSearch(): Promise<any> {
const.client = new elasticsearch.Client();
client.search({
q: 'pants'
}).then(function (body) {
var hits = body.hits.hits;
return; //????
}, function (error) {
console.trace(error.message);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment