Created
December 28, 2018 01:00
-
-
Save ahmadarif/60e060a184d7e1522d503a5c83d243c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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