Created
February 17, 2016 03:54
-
-
Save parijatmishra/369bd0342c20485cdc64 to your computer and use it in GitHub Desktop.
boto3 - cloudsearch - describe_domains() and describe_index_fields()
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
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?