Format of a document that is pushed in real time
[
{
"cmd": "add",
"fields": {
"id": "1",
"title": "This is the title",
"body": "This is the body",
"tags" : [1, 2, 3]
}
},
{
"cmd": "update_field",
"fields": {
"id": "2",
"title": "This is the new title"
}
},
{
"cmd": "delete",
"fields": {
"id": "3"
}
}
]An OpenSearch Retrieval Engine Edition document includes two parameters: cmd and fields. Both parameters are required.
cmd: specifies how a document is processed.
add: adds the document. If the document already exists, it is deleted and then added again.
update_field: updates specific fields in the document.
delete: deletes the document. If you want to delete a document, you must specify the primary key field of the document. If you build an index by using the multi-level hashing structure, you must specify the primary key field of each level of hash.
fields: the fields that are included in the document. You must specify the primary key field in the fields parameter. A multi-value field is of the ARRAY data type and needs to be converted to a JSON array, such as [{"fields": {"id": "0", "int_array": [14,85], "string_array": ["abc", "xyz"]}, "cmd": "ADD"}].
OpenSearch Retrieval Engine Edition provides a demo for the data push SDK.
Format of a full document
OpenSearch Retrieval Engine Edition only supports MaxCompute tables as full data sources. The field names in the schema must be the same as the field names in the MaxCompute table. The multi-value fields in a MaxCompute table must be separated by delimiters '\x1D' ('^]'). You do not need to specify the cmd parameter for data in a MaxCompute table. By default, data is added for a full document.
Usage notes
Do not use some built-in characters of OpenSearch Retrieval Engine Edition in a document. The following table describes the built-in characters.
Encoding | Display pattern in Emacs or Vi | Input method in Emacs | Input method in Vi |
"\x1E\n" | ^^ (followed by a link break) | C-q C-6 | C-v C-6 |
"\x1F\n" | ^_ (followed by a link break) | C-q C-7 | C-v C-7 |
"\x1D" | ^] | C-q C-5 | C-v C-5 |
"\x1C" | ^\ | C-q C-4 | C-v C-4 |
"\x03" | ^C | C-q C-c | C-v C-c |
Do not use the delimiter '\x1D' ('^]') in real-time data.
Do not use the delimiter '\x1D' ('^]') in fields of the TEXT data type.