describe_index_fields ( $domain_name, $opt )

Gets information about the index fields configured for the search domain. Can be limited to specific fields by name. Shows all fields by default.

Access

public

Parameters

Parameter

Type

Required

Description

$domain_name

string

Required

A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. [Constraints: The value must be between 3 and 28 characters, and must match the following regular expression pattern: [a-z][a-z0-9-]+]

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • FieldNames - string|array - Optional - Limits the DescribeIndexFields response to the specified fields. Pass a string for a single value, or an indexed array for multiple values.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Create and delete an index field.

// Instantiate the class
$search = new AmazonCloudSearch();

$domain_name = 'my-domain';
$index_field = 'test_integer';

/*%**************************************************************%*/
// Create a new CloudSearch domain

echo '# Creating a new CloudSearch domain' . PHP_EOL;
$response = $search->create_domain($domain_name);

// Check for success...
if ($response->isOK())
{
	echo 'Kicked off the creation of the CloudSearch domain...' . PHP_EOL;
}
else
{
	print_r($response);
}

echo PHP_EOL;

/*%**************************************************************%*/
// Define index fields

echo '# Defining a new CloudSearch index field' . PHP_EOL;
$response = $search->define_index_field($domain_name, array(
	'IndexFieldName' => $index_field,
	'IndexFieldType' => 'uint',
));

// Check for success...
if ($response->isOK())
{
	echo 'Defined an index field...' . PHP_EOL;
}
else
{
	print_r($response);
}

echo PHP_EOL;

/*%**************************************************************%*/
// Describe index fields

echo "# Describing the CloudSearch index fields, \"${domain_name}\"" . PHP_EOL;
$response = $search->describe_index_fields($domain_name);

print_r($response->body->IndexFieldName()->map_string());

echo PHP_EOL;

/*%**************************************************************%*/
// Index documents

echo "# Indexing documents, \"${domain_name}\"" . PHP_EOL;
$response = $search->index_documents($domain_name);

print_r($response->body->member()->map_string());

echo PHP_EOL;

/*%**************************************************************%*/
// Delete index fields

echo '# Deleting the CloudSearch index field...' . PHP_EOL;
$response = $search->delete_index_field($domain_name, $index_field);

// Check for success...
if ($response->isOK())
{
	echo 'CloudSearch index field was deleted successfully.' . PHP_EOL;
}
else
{
	print_r($response);
}

echo PHP_EOL;

/*%**************************************************************%*/
// Delete the CloudSearch domain

echo '# Deleting the CloudSearch domain...' . PHP_EOL;
$response = $search->delete_domain($domain_name);

// Check for success...
if ($response->isOK())
{
	echo 'CloudSearch domain was deleted successfully.' . PHP_EOL;
}
else
{
	print_r($response);
}

Source

Method defined in services/cloudsearch.class.php | Toggle source view (16 lines) | View on GitHub

public function describe_index_fields($domain_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['DomainName'] = $domain_name;
    
    // Optional list (non-map)
    if (isset($opt['FieldNames']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'FieldNames' => (is_array($opt['FieldNames']) ? $opt['FieldNames'] : array($opt['FieldNames']))
        ), 'member'));
        unset($opt['FieldNames']);
    }

    return $this->authenticate('DescribeIndexFields', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback