Create an index attribute

post

/gsadmin/v1/{appName}/attributes/{owner}/{attributeName}

Creates a new attribute in the specified config owner attributes list.

Request

Supported Media Types
Path Parameters
Body ()
The attribute to create.
Root Schema : Attribute
Type: object
Represents an index attribute. The object conforms to one of the following ecr-types:
  • dimension
  • property
  • derived-property
Show Source
Nested Schema : context
Type: array
Attributes can be contextual by one of two types: locale or priceGroup, but not both. Custom contexts won't work.
Show Source
Nested Schema : DisplayConfig
Type: object
Contains configuration on how to display a facet and its facet values.
Show Source
  • This defines a list of sort options for sorting the values of this facet. Each sort option is specified by a sort function, comma, sort order. Multiple sort options are separated by semicolons and any number of sort options may be specified. Possible sort functions are 'displayName', 'sig', 'count', and 'displayOrder' and sort orders are 'asc' and 'desc'. For example, to sort by displayOrder ascending and break ties by counts descending use 'displayOrder,asc;count,desc'. 'displayName' will sort the values alphabetically. 'count' will sort the values based on the count of records tagged to (otherwise known as facet value counts). 'displayOrder' will order the values based on the corresponding 'displayOrder' values as configured using /gsdata/v1/{appName}/facets. 'sig' sorts the list of facet values by relevance to the current query by computing the statistical significance of this facet value over the result list. If no sort is configured, the facet values will be sorted by count descending. Deprecated older values (but still accepted) are 'alpha', 'freq' and 'rank', which correspond to 'displayName', 'count' and 'displayOrder' respectively.
  • translations
    This allows you to specify per-locale translations of the display name for this facet. If no 'displayName' values are configured, or are omitted for a given locale, then the facet name is returned. Locale codes are those used by search and comply with BCP-47 Locale codes in Java. You can cross-reference the locales currently configured for search by GET /gsadmin/v1/cloud/searchIndexConfig.
Example:
{
    "sort":"displayName,asc;count,desc",
    "translations":{
        "en":{
            "displayName":"Brand"
        },
        "fr":{
            "displayName":"Marque"
        }
    }
}
Nested Schema : indexingTransforms
Type: array
Show Source
  • IndexingTransform
    Specifies a transformation to apply upon one or more source properties (inputs). The attribute which defines the transform is the destination property.
Nested Schema : SeoConfig
Type: object
Contains configuration on which dimensions are included in SEO links. Respected only if using SeoUrlFormatterFactory.
Show Source
Nested Schema : sourcePropertyNames
Type: array
Show Source
Nested Schema : translations
Type: object
This allows you to specify per-locale translations of the display name for this facet. If no 'displayName' values are configured, or are omitted for a given locale, then the facet name is returned. Locale codes are those used by search and comply with BCP-47 Locale codes in Java. You can cross-reference the locales currently configured for search by GET /gsadmin/v1/cloud/searchIndexConfig.
Show Source
Nested Schema : localeCode
Type: object
A locale code where you wish to provide translations
Show Source
Nested Schema : IndexingTransform
Type: object
Specifies a transformation to apply upon one or more source properties (inputs). The attribute which defines the transform is the destination property.
Show Source
  • The outputs of an indexing transform are made unique by suppressing any values that repeat existing assignments.
  • Discard the input properties that were used to generate the transform's output.
  • sourcePropertyNames
    An ordered list of inputs that the transform will consume. In the case of 'concatenate' transform, the first sourceProperty's value will appear first in the output value. If omitted, or identical to the output property name, then the transform happens in-place (an Identity Transform). The type 'split-jsonpath' is only supported as an Identity Transform.
  • List of JSON paths into the source properties from which to extract values. Only applies to 'split-jsonpath' transform
  • Regular expression that describes all delimiters between values. Only applies to 'split-regex' transform.
  • Allowed Values: [ "concatenate", "split-regex", "split-jsonpath" ]
    The specific type of transformation:
    • concatenate: combines the values from the source properties into a single value, in the order that the source properties are specified. If any source properties have contextual (localized) values, then a separate output value shall be produced, restricting its inputs on a per-locale basis.
    • split-regex: Separates the source properties' values into pieces based on the regex that encodes the separator value. Each piece becomes a distinct output value.
    • split-jsonpath: Uses the supplied json paths to extract scalar values from source properties whose values contain json. Each scalar becomes an assignment in the output property. NOTE: 'split-jsonpath' is only supported as an Identity Transform.
  • Once source properties have been split into pieces via regular expression, remove whitespace from the ends of the pieces. Only applies to split-regex transform.
Example:
{
    "transform":"split-jsonpath",
    "splitPaths":[
        "$['product.childSKUs'][*]['sku.id]",
        "$['product.childSKUs'][*]['shoe.size']",
        "$['product.childSKUs'][*]['shirt.size']"
    ]
}
Nested Schema : sourcePropertyNames
Type: array
An ordered list of inputs that the transform will consume. In the case of 'concatenate' transform, the first sourceProperty's value will appear first in the output value. If omitted, or identical to the output property name, then the transform happens in-place (an Identity Transform). The type 'split-jsonpath' is only supported as an Identity Transform.
Show Source
Security
Back to Top

Response

Supported Media Types

201 Response

Index attribute successfully created.
Body ()
Root Schema : Response
Type: object
Show Source
Back to Top

Examples

Request Body Example

The following shows a sample request body to create an attribute with ecr-type: ???property??? in the specified owner index attributes list.

:content = {
  ecr:lastModifiedBy: "admin",
  propertyDataType: "ALPHA",
  ecr:lastModified: "2017-10-15T15:50:27.062Z",
  sourcePropertyNames: [
    "camera.Aperture range"
  ],
  ecr:createDate: "2017-10-15T15:50:26.839Z",
  ecr:type: "property"
}

The following shows a sample request body to create an attribute with ecr-type: ???dimension??? in the specified owner index attributes list. The displayConfig parameter specifies that dimension values in this dimension are sorted in descending order of frequency; ties are sorted in ascending alphabetical order.

{
	"camera.color": {
		"isWildcardEnabledInRecordSearch": true,
		"displayOrder": 4,
		"displayConfig": {
			"sort": "freq,desc;alpha,asc"
		},
		"sourcePropertyNames": ["camera.Color of product"],
		"isAutogen": true,
		"isRecordSearchEnabled": true,
		"ecr:type": "dimension",
		"mergeAction" : "update"
	}
}
Back to Top