| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
When a request completes successfully, the response body contains the search results. By default, search results are returned in JSON. If the results-type parameter is set to XML, search results are returned in XML.
When a request returns an error code, the body of the response contains information about the error that occurred. Error responses are always returned in JSON. If an error occurs while the request body is parsed and validated, the error code is set to 400 and the response body includes a list of the errors and where they occurred.
The following example shows a JSON response.
{
"rank":"-text_relevance",
"match-expr":"(label 'star wars')",
"hits":{
"found":7,
"start":0,
"hit":[
{"id":"tt1185834",
"data":{
"actor":["Abercrombie, Ian","Baker, Dee","Burton, Corey"],
"title":["Star Wars: The Clone Wars"]
}
},
.
.
.
{"id":"tt0121766",
"data":{
"actor":["Bai, Ling","Bryant, Gene","Castle-Hughes, Keisha"],
"title":["Star Wars: Episode III - Revenge of the Sith"]
}
}
]
},
"info":{
"rid":"b7c167f6c2da6d93531b9a7b314ad030b3a74803b4b7797edb905ba5a6a08",
"time-ms":2,
"cpu-time-ms":0
}
} The following example shows the equivalent XML response:
<?xml version="1.0" encoding="UTF-8"?>
<results xmlns="http://cloudsearch.amazonaws.com/2011-02-01/results">
<rank>-text_relevance</rank>
<match-expr>(label 'star wars')</match-expr>
<hits found="7" start="0">
<hit id="tt1185834">
<d name="actor">Abercrombie, Ian</d>
<d name="actor">Baker, Dee</d>
<d name="actor">Burton, Corey</d>
<d name="title">Star Wars</d>
</hit>
.
.
.
<hit id="tt0121766">
<d name="actor">Bai, Ling</d>
<d name="actor">Bryant, Gene</d>
<d name="actor">Castle-Hughes, Keisha</d>
<d name="title">Star Wars: Episode III - Revenge of the Sith</d>
</hit>
</hits>
<facets/>
<info
rid="b7c167f6c2da6d93531b9a7b314ad030a5ddfe34efbdd8959999ac792f37a1f"
time-ms="2"
cpu-time-ms="0"
/>
</results>| Name | Description |
|---|---|
Content-Type | A standard MIME type describing the format of the object data. For more information, see
W3C RFC 2616 Section 14.
Default: application/json Constraints: application/json or application/xml only |
Content-Length | The length in bytes of the body in the response. |
| Property | Description |
|---|---|
match-expr | Shows the match expression constructed from the search parameters. |
hits | Contains hit statistics (found, start) and a hit array that lists the document ids and data for each hit. |
found | The total number of hits that match the search request after Amazon CloudSearch finished processing the match set. |
start | The index of the first hit returned in this response. |
hit | An array that lists the document ids and data for each hit. |
id | The unique identifier for a document. |
data | A list of returned fields. |
facets | Contains facet information and facet counts. |
| A field for which facets were calculated. |
constraints | An array of the facet values and counts. |
value | The facet value being counted. |
count | The number of hits that contain the facet value in FacetFieldName.
|
info | Contains information about the request processing. |
rank | Lists the fields that were used to rank the search hits. |
rid | The encrypted Resource ID. |
time-ms | How long it took to process the search request in milliseconds. |
cpu-time-ms | The CPU time required to process the search request in milliseconds. |
messages | Contains any warning or error messages returned by the search service. The severity, code, and message properties are included for each warning or error. |
severity | Whether the message is a warning or error. |
code | The warning or error code. The search service returns the following warnings and errors:
|
| message | A description of the warning or error that was returned by the search service. |
| Name | Description |
|---|---|
results | If the request was successful, contains the search results. If an error occurs, the info element lists the warnings or errors that were returned by the search service. |
rank | Lists the fields that were used to rank the search hits. |
match-expr | Shows the match expression constructed from the search parameters. |
hits | Contains hit statistics and a collection of hit elements. The found attribute is the total number of hits that match the search request after Amazon CloudSearch finished processing the results. The contained hit elements are ordered according to their text_relevance scores or the rank option specified in the search request. |
hit | A document that matched the search request. The id attribute is the document's unique id. Contains a
d (data) element for each returned field.
|
d | A field returned from a hit. Hit elements contain a d (data) element for each returned field.
|
facets | Contains a facet element for each facet requested in the search request. |
facet | Contains a constraint element for each value of a field for which a facet count was calculated. The facet-FIELD-top-n request parameter can be used to specify how many constraints to return. By default, facet counts are returned for the top 40 constraints. The facet-FIELD-constraints request parameter can be used to explicitly specify which values to count.
|
constraint | A facet field value and the number of occurrences (count) of that value within the search hits. |
info | Information about the request processing. The rid attribute is the encrypted Resource ID. The time-ms attribute is how long it took to process the search request, in milliseconds. The cpu-time-ms attribute is the CPU time required to process the search request, in milliseconds.
|
message | Information about a warning or error returned by the search service while processing the request. The severity
attribute is either warning or error. The code attribute specifies one of the following warning or error codes:
|