JSON API
...
Examples
Batch Updates
Custom Attributes
8min
in the swagger/openapi specification docid\ w5ivv5q4jjbffywxds5p8 , you will find that we have some predefined attributes for the item that will not suffice all the use cases, e g you have brand, color, size, etc fields for your product before indexing the additional attributes, the attribute definition needs to be created details of various options are available in the api schema the above api has created two attributes, brand and size important to note that the attribute key should be sanitized, without any special characters this needs to be done only once, not every time you index products for more information on the supported data types, please refer to the data types docid\ ib9ci4foeiffeforoxofo once the attribute definition is created, let's index the product \[ { "id" "1", "type" "klevu product", "attributes" { "name" { "default" "product 1" }, "brand" "ucb", "size" "s" } }, { "id" "2", "type" "klevu product", "attributes" { "name" { "default" "product 2" }, "brand" "ucb", "size" "m" } } ] in the above example, we have indexed the two new attributes to the product, i e brand and size example for multivalue attribute registration a sample batch request \[ { "id" "1", "type" "klevu product", "attributes" { "name" { "default" "product 1" }, "brand" "ucb", "materials" \[ "20% cotton", "80% polyester" ] } } ] abbreviate the abbreviations feature allows you to automatically generate shortened forms of values for searchable attributes this can be useful for improving search relevance and efficiency by default, the attributes with key "brand" and "manufacturer are abbreviated to enhance search and retrieval efficiency the abbreviation logic follows these steps initials generation each word in the submitted data is abbreviated to its initials example "larsen & toubro" becomes "l\&t" handling special characters special characters like "&" are replaced with no space example "larsen & toubro" becomes "lt" for a given value "larsen & toubro", the abbreviations generated are l\&t using initials with special characters preserved lt after replacing special characters example rangeable this property enhances search flexibility by allowing users to filter data based on numeric ranges, optimizing search and retrieval operations it only works with the attributes that are registered as number or multivalue number as a data type example