Skip to content

Instantly share code, notes, and snippets.

@ahmadarif
Created December 28, 2018 01:00
Show Gist options
  • Save ahmadarif/60e060a184d7e1522d503a5c83d243c5 to your computer and use it in GitHub Desktop.
Save ahmadarif/60e060a184d7e1522d503a5c83d243c5 to your computer and use it in GitHub Desktop.
'use strict'
const Helpers = use('Helpers')
const Client = use('App/Elastic/connection-sp.js')
const ElasticSearch = Helpers.promisify(Client.search)
class SearchController {
async search({ request, response }) {
try {
const response = await ElasticSearch({
index: 'data360lighting',
type: 'doc',
body: {
query: {
match: { "descricao_do_produto": "ourolux" }
},
}
})
response.send(response)
} catch (error) {
response.send({ message: `Search error: ${error}` })
}
}
}
module.exports = SearchController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment