| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The body of a documents/batch request uses the Search Data Format (SDF) to specify the document operations you want to perform. For example:
<batch> <add id="tt0484562" version="1" lang="en"> <field name="title">The Seeker: The Dark Is Rising</field> <field name="director">Cunningham, David L.</field> <field name="genre">Adventure</field> <field name="genre">Drama</field> <field name="genre">Fantasy</field> <field name="genre">Thriller</field> <field name="actor">McShane, Ian</field> <field name="actor">Eccleston, Christopher</field> <field name="actor">Conroy, Frances</field> <field name="actor">Ludwig, Alexander</field> <field name="actor">Crewson, Wendy</field> <field name="actor">Warner, Amelia</field> <field name="actor">Cosmo, James</field> <field name="actor">Hickey, John Benjamin</field> <field name="actor">Piddock, Jim</field> <field name="actor">Lockhart, Emma</field> </add> <delete id="tt0301199" version="1" /> </batch>
The Relax NG schema for an XML representation of a batch is shown below:
start = batch
sdf.field_name = xsd:token {
minLength = "1"
maxLength = "64"
pattern = "[a-z0-9][a-z0-9_]{0,63}"
}
sdf.id = xsd:token {
minLength = "1"
maxLength = "128"
pattern = "[a-z0-9][a-z0-9_]{0,127}"
}
sdf.version = xsd:integer {
minExclusive = "0"
maxExclusive = "4294967295"
}
batch = element batch {
(element add {
attribute id { sdf.id },
attribute version { sdf.version },
attribute lang { xsd:language },
element field {
attribute name { sdf.field_name },
text
}+
}
| element delete {
attribute id { sdf.id },
attribute version { sdf.version },
empty
})+
}
| Element | Description | Required |
|---|---|---|
| batch | The collection of add or delete operations that you want to submit to your search domain. A batch must contain at least one add or delete element. | Yes |
| add | Specifies a document that you want to add to your search domain. The id, version, and lang attributes are required and an add element must contain at least one field.
Attributes:
| No |
| field | Specifies a field in the document being added. The name attribute and a field value are required. Field names must begin with a letter and can contain the following characters: a-z (lower case), 0-9, and _ (underscore). The names "body", "docid", and "text_relevance" are reserved names and cannot be used as field names. The field value can be text or CDATA.
To specify multiple values for a field, you include multiple field elements with the same name. For example: <field name="genre">Adventure</field> <field name="genre">Drama</field> <field name="genre">Fantasy</field> <field name="genre">Thriller</field>
Constraints:
Condition: At least one field must be specified in an add element. | Conditional |
| delete | Specifies a document that you want to remove from your search domain. The id and version attributes are required. A delete element must be empty.
Constraints:
| No |
The response body lists the number of adds and deletes that were performed and any errors or warnings that were generated.
The RelaxNG schema of a document service API response is:
start = response
response = element response {
attribute status { "success" | "error" },
attribute adds { xsd:integer },
attribute deletes { xsd:integer },
element errors {
element error {
text
}+
}? &
element warnings {
element warning {
text
}+
}?
}| Element | Description |
|---|---|
| result | Contains elements that list the errors and warnings generated when parsing and validating the request. Attributes:
Constraints:
If the status is |
| errors | Contains a collection of error elements that identify the errors that occurred when parsing and validating the request. |
| error | Provides information about a parsing or validation error. The value provides a description of the error. |
| warnings | Contains a collection of warning elements that identify the warnings that were generated when parsing and validating the request. |
| warning | Provides information about a parsing or validation warning. The value provides a description of the error. |