Elasticsearch index schema changes

The following Elasticsearch index schema changes are performance and customization-related enhancements that were introduced with the Commerce+ release.

Product schema

Customizations that involve facets may encounter restrictions in Commerce+ version. The facets type has been changed from object to flattened, as defined in Ingest/config/product_elastic_schema.json.
"facets": {
  "type": "flattened"
}
For information about the features and limitations of this field type, see Flattened field type in the ElasticSearch Guide.

Category schema

Element Schema change
_id In Commerce+, category ids are simplified by removing entries based on parentCategoryId.
  • In earlier releases, every time a category is linked under another parent category, a new document is generated.
    The _id field is constructed in the following format:
    storeId-langId-catalogId-parentCategoryId-categoryId
    For example, Apparel (categoryId=1) is a top level category (parentCategoryId=-1) in both the master catalog (catalogId=10001) and the sales catalog (catalogId=10502) within the AuroraESite store (storeId=1):
    "_id": "1--1-10001--1-1"
    "_id": "1--1-10502--1-1"
    If a category, Dress (categoryId=10001) is linked under another sales category (categoryId=3074457345616677668), then there are three documents with the following _id:
    "_id": "1--1-10001-3-10001"
    "_id": "1--1-10502-3-10001"
    "_id": "1--1-10502-3074457345616677668-10001"
  • In Commerce+, the same category within the same catalog has only one document.
    The _id field is in the following format:
    storeId-langId-catalogId-categoryId
    For the same example of Apparel above, the _id field of the category has the format:
    "_id": "1--1-10001-1"
    "_id": "1--1-10502-1"
    For the category, Dress, which is linked under another sales category, Hot Buys, there are two documents:
    "_id": "1--1-10001-10001"
    "_id": "1--1-10502-10001"
category In Commerce+, category definitions are simplified into single entries, by enabling them to be defined with multiple parents.

Top level categories

  • In earlier releases, the category element has both path and child elements.
    "category": {
        "sequence": 4.0,
        "catalog": "10001",
        "path": {
            "name": [
                "Apparel"
            ],
            "id": [
                "1"
            ]
        },
        "child": [
            "2",
            "3",
            "4",
            "5"
        ]
    }
  • In Commerce+, the child element is moved up to the same level as the category element, and the path element is removed.
    "category": [
        {
        "parent": "-1",
        "sequence": 1.0
        }
    ]
        "child": [
        "2",
        "3",
        "4",
        "5"
    ]
Leaf categories

A leaf category, Dress, is under the category, Women, as well as the Hot Buys sales category.

  • In earlier releases:
    • There are two documents within the sales catalog (10502). One document is under the Women category (3), and a second document is for the Hot Buys category (3074457345616677668).
    • Each document has a single value path element.
    • "category": {
          "parent": 3,
          "sequence": 0.0,
          "catalog": "10502",
          "path": {
              "name": [
                  "Apparel",
                  "Women",
                  "Dresses"
              ],
              "id": [
                  "1",
                  "3",
                  "10001"
              ]
          }
      }
      "path": /1/3/10001"
    • "category": {
          "parent": 3074457345616677668,
          "sequence": 0.0,
          "catalog": "10502",
          "path": {
              "name": [
                  "Hot Buys",
                  "Dresses"
              ],
              "id": [
                  "3074457345616677668",
                  "10001"
              ]
          }
      }
      "path": "/1/3/3074457345616677668"
  • In Commerce+ release:
    • There is only one document in the sales catalog. This contains both the Women category (3), and the Hot Buys category (3074457345616677668).
    • The path element can now contain multiple values.
    • The sequences element is at the same level as category, for sorting.
    "category": [
        {
        "parent": 3,
        "sequence": 0.0
        },
        {
        "parent": 3074457345616677668,
        "sequence": 0.0"
        }
    ]
    
    "path": [
        "/1/3/10001",
        "3074457345616677668/10001"
    ]
    
    "sequences": {
        "3": {
            "sequence": 0.0
        },
        "3074457345616677668": {
            "sequence": 0.0
        }
    }

Product schema

Element Schema change
identifier In Commerce+ release, the pn element is removed. This is due to the fact that it duplicates the values of the sku element.
For example:
  • In earlier releases:
    "identifier": {
        "specification": "product",
        "language": "en_US",
        "sku": {
            "normalized": "AuroraWMDRS-1",
            "raw": "AuroraWMDRS-1"
        }
        "pn": {
            "normalized": "AuroraWMDRS-1",
            "raw": "AuroraWMDRS-1"
        }   
    }
  • In Commerce+ release:
    "identifier": {
        "specification": "product",
        "language": "en_US",
        "sku": {
            "normalized": "AuroraWMDRS-1",
            "raw": "AuroraWMDRS-1"
        }
    }
category In Commerce+ release, the category element is simplified by removing path entries. This information is placed into a peer element, path_name. The category entry only contains direct parent categories. This eliminates many duplicate entries.
For example:
  • In earlier releases:
    "category": {
        "10001-1-3-10001": {
            "parent": "10001",
            "sequence": "1",
            "path": {
                "name": [
                    "Apparel",
                    "Women",
                    "Dresses"
                ]
                "id": [
                    "1",
                    "3",
                    "100001",
                ]
            },
            "catalog": "10001",
            "name": "Dresses"
        },
        "10502-1-3-10001": {
            "parent": "10001",
            "sequence": "1",
            "path": {
                "name": [
                    "Apparel",
                    "Women",
                    "Dresses"
                ]
                "id": [
                    "1",
                    "3",
                    "10001",
                ]
            },
            "catalog": "10502",
            "name": "Dresses"
        }
        "10502-3074457345616677668-10001": {
            "parent": "10001",
            "sequence": "1",
            "path": {
                "name": [
                    "Hot Buys",
                    "Dresses"
                ]
                "id": [
                    "1",
                    "3",
                    "3074457345616677668",
                ]
            },
            "catalog": "10502",
            "name": "Dresses"
        }
    }
  • In Commerce+ later release:
    "category": {
        "10502-10001": {
            "sequence": "1",
            "name": "Dresses",
            "id": "10001"
        },
        "10001-10001": {
            "sequence": "1",
            "name": "Dresses",
            "id": "10001"
        }
    }
    "path_name": {
        "10001": [
            "Women",
            "Dresses",
            "Apparel"
        ]
        "10502": [
            "Women",
            "Dresses",
            "Apparel",
            "Hot Buys"
        ]
    }
attributes In Commerce+ release, the key element is removed. This is due to the fact that it duplicates the values of the id element.
For example:
  • In earlier releases:
    "attributes": {
        "70000000000000006": {
            "identifier": "occasion",
            "usage": "Descriptive",
            "displayable": true,
            "ribbon": false,
            "merchandisable": false,
            "searchable": false,
            "sequence": 1.0,
            "name": {
                ...
            },
            "facetable": false,
            "id": "70000000000000006",
            "comparable": true,
            "value": [
                ...
            ],
            "key": "70000000000000006",
            "swatchable": false
        }
    }
  • In Commerce+ release:
    "attributes": {
        "70000000000000006": {
            "identifier": "occasion",
            "usage": "Descriptive",
            "displayable": true,
            "ribbon": false,
            "merchandisable": false,
            "searchable": false,
            "sequence": 1.0,
            "name": {
                ...
            },
            "facetable": false,
            "id": "70000000000000006",
            "comparable": true,
            "value": [
                ...
            ],
            "swatchable": false
        }
    }