Sync Custom Fields

Before start, thanks for using our products :). So this is the first step to integrate with our system. Before you send us your data, you must tell us some additional fields that we have't provide. When you create an engine, you can see the field that we provide in the client panel (Performance Settings -> Custom Rankings -> Mapping Field). Those fields are the default fields that we generate base on your engine's profile (ecommerce, custom, or blog) when you create the engine. There are 4 atrributes that you have to give when adding fields using this endpoint.

The first one is 'name', which tell us the name of the fields. The second one is 'type', which described the data type of the fields.You can choose one of many datatype that are provided by elasticsearch. The common data types that we used are object, text, keyword, long, integer, short, byte, double, float, half_float, scaled_float, date, boolean, binary, integer_range, float_range, long_range, double_range, date_range, geo_point. The third one is 'synonyms' this is also important. We have a feature called synonyms, so this attribute will help us to identify either your new field will be applied with this logic or not. You have to fill this attribute with 'true' or 'false'. Last but not least, an attribute that called 'index'. This one will help us to identify either the field can be used to do search or not. So here is the example and all params that you have to provide.

We also use title, image_link, thumb_link for rendering the data in boosting and custom results page. So please fill these 3 fields with the correct value. For example if you have productName, please duplicate the value and insert it to title field, so we can render the boosting page properly for you. Same thing goes with image_link and thumb_link

For nested fields. Example: {"brand": {"name": "brand_name" }} Just use the type: "object"

note

Don't include the default field to the request body, the concept is sync not add or remove. It means that if you hit this endpoint by having 'thumb_link' and 'description' at first, then you hit this api again with just 'thumb_link' as request body, THE 'DESCRIPTION' WILL BE DELETED.

POST#

https://api.altoshift.com/api/mapping/sync

Example Usage#

curl -H "Content-Type: application/json" \
-H "x-token: 2b46ad0b537229cf450777dcc655a8620571e18556c473f065f44739" -d \
'{
"customFields": [
{
"name": "brand",
"type": "object",
"applySynonyms": false,
"ignoreNonAlphanum": true,
"index": false
},
{
"name": "image_link",
"type": "text",
"applySynonyms": false,
"ignoreNonAlphanum": false,
"index": false
},
{
"name": "thumb_link",
"type": "text",
"applySynonyms": false,
"ignoreNonAlphanum": false,
"index": false
}
{
"name": "title",
"type": "text",
"applySynonyms": true,
"ignoreNonAlphanum": true,
"index": true
}
]
}' https://api.altoshift.com/api/mapping/sync

Header#

FieldTypeDescription
x-tokenStringtoken Users unique token

Request Body#

FieldTypeDescription
customFieldsObject[]Custom Fields objects
    nameStringName of custom fields
    typeStringType of custom fields
    ignoreNonAlphanumBooleanIgnore Non Alphanum characters or not , must be filled with true or false - default: false
    applySynonymsBooleanApply synonyms or not (only set true to type: text), must be filled with true or false - default: false
    indexBooleanIndex the fields or not (to be searchable or not), must be filled with true or false - default: false
    filterBooleanThe value must between "term" or "range". Apply filter in the specific fields, to apply filter the index must true

Success Response#

FieldTypeDescription
successBooleanRequest was successful

Success Example#

{
"success": true
}