The dynamic attributes object

The dynamic attributes (dyn_attrs) object is a composite list of multiple attribute names, values (of various data types), and an optional sort order.

  • label - a string that displays the name of the attribute.

  • name (optional) - an attribute name corresponding to the label following Search convention. this is generated automatically if not provided.

  • value - a string that represents the attribute value. You can mix string and numeric values in one list. All values are treated as string. 

  • order - an optional order (float) by which to sort the original values when returned in facets. If not provided, or if same order value is specified more than once, the values are sorted by descending frequency within that facet.

  • name_order - an optional order (float) used to sort the facet names (label) for this dynamic attribute collection. The sort order is ascending. If no order is specified, or if the same order value is specified more than once, then the facets are ordered by descending frequency.

This sample code shows a dyn_attrs object:

"dyn_attrs": [
                {
                    "label": "Unit",
                    "value": "Pieces",
                    "order": 1,
                    "name": "unit",
                    "name_order": 35
                },
                {
                    "label": "Track Length",
                    "value": "121 In.",
                    "order": 121,
                    "name": "track_length",
                    "name_order": 21
                },
                {
                    "label": "Lug Height",
                    "value": "5/16 in.",
                    "order": 0.3125,
                    "name": "lug_height",
                    "name_order": 10
                }
            ],
Note

When performing an incremental update on a document that includes dynamic attributes, the existing attribute values are overridden. Search does not patch or merge the new values with the existing ones.

If you have suggestions for improving this article, let us know!