Been trying to pull search results from my cloudsearch domain. Every example online is for the older sdk. I did my best to compile this code, but I'm getting an error:
"getaddrinfo ENOTFOUND cloudsearchdomain.us-east-1.amazonaws.com"
I'm guessing the domain needs to be specified somewhere. Also, the query format is a bit obscure to me
import {
CloudSearchDomainClient,
SearchCommand,
SearchCommandInput
} from '@aws-sdk/client-cloudsearch-domain';
export class SearchService {
private client: CloudSearchDomainClient;
constructor() {
this.client = new CloudSearchDomainClient({
region: 'us-east-1',
apiVersion: '2013-01-01'
});
}
async GetSearchResults(query: string): Promise<any> {
const params: SearchCommandInput = {
query: 'leg'
};
const command = new SearchCommand(params);
return await this.client.send(command);
}
}
Figured it out between running it on the console, searching the package comments and online docs I was able to piece it together (and had some fun)