Skip to content

Instantly share code, notes, and snippets.

@parijatmishra
Created February 17, 2016 03:54
Show Gist options
  • Save parijatmishra/369bd0342c20485cdc64 to your computer and use it in GitHub Desktop.
Save parijatmishra/369bd0342c20485cdc64 to your computer and use it in GitHub Desktop.
boto3 - cloudsearch - describe_domains() and describe_index_fields()
import boto3
client = boto3.client('cloudsearch')
# List properties of all domains
print "List all domains"
domains = []
response = client.describe_domains()
for domain in response['DomainStatusList']:
domain_name = domain['DomainName']
domains.append(domain_name)
print domain_name
# List properties of specific domains - if you had a domain name
# Assuming there was at least one domain in the response above
domain = domains[0]
print "{}".format(domain)
response = client.describe_domains(DomainNames=[domain])
print " ARN: {}".format(domain, response['DomainStatusList'][0]['ARN'])
# Describe all index fields of 'domain'
print " Index Fields:"
response = client.describe_index_fields(DomainName=domain)
fields_info = response['IndexFields']
for field_info in fields_info:
field_name = field_info['Options']['IndexFieldName']
field_type = field_info['Options']['IndexFieldType']
print " {}: {}".format(field_name, field_type)
@avizvaRumit
Copy link

Its not able to search domain with Engine Type "CloudSearch (2011 API)". Could you please check and suggest how to use describe_domains(DomainNames=[domain]) with domain names of 2011 API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment