Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AWS Lambda function to class Cloud Search API with javascript SDK
exports.handler = (event, context, callback) => {
var csd = new AWS.CloudSearchDomain({
endpoint: CS_NAME+'.'+SERVICES_REGION+'',
apiVersion: '2013-01-01'
var params = {
query: event.query,
sort: '_score desc',
size: event.size, // number of documents to return
start: event.start, // start index of document list to return (cf multi tab)
queryOptions: JSON.stringify({fields: ['content']}),
// see documentation at :
//, function(err, data) {
if (err) {
callback('CloudSearch ERROR');
else {
callback(null, data); // SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment