Retrieval Engine Edition documents consist of a cmd field and a fields field. You can push documents in real time or import full data from MaxCompute.
Real-time push document format
[
{
"cmd": "add",
"fields": {
"id": "1",
"title": "This is the title",
"body": "This is the body",
"tags" : [1, 2, 3]
}
},
{
"cmd": "delete",
"fields": {
"id": "3"
}
}
]
Each document requires two fields: cmd and fields.
-
cmd: the operation to perform on the document.
-
add: adds a document. If the document already exists, it is overwritten.
-
delete: deletes a document. You must specify the primary key of the document. If the index uses multi-level hashing, you must also specify the primary key for each level.
-
-
fields: the document fields. You must include the primary key field. A multi-value field is an array and must be formatted as a JsonArray. For example: [{"fields": { "id": "0","int_array": [14,85],"string_array": ["abc","xyz"]},"cmd": "ADD"}].
The retrieval engine provides an SDK for data push.
Full data document format
The Retrieval Engine supports only MaxCompute as a full data source. The field names in the schema must match those in MaxCompute. For multi-value fields, separate values with the multi-value separator `'\x1D'` (`'^]`). You do not need to specify a `cmd` for MaxCompute data because all records are treated as `add` operations during a full import.
Notes
-
Do not use the following built-in characters in your documents:
|
Code |
Display in (emacs/vi) |
Input method in emacs |
Input method in vi |
|
"\x1E\n" |
^^ (followed by a line break) |
C-q C-6 |
C-v C-6 |
|
"\x1F\n" |
^_ (followed by a line 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 multi-value separator '\x1D' ('^]') in data for real-time push.
-
Do not use the multi-value separator '\x1D' ('^]') in fields of the TEXT type.