Skip to content

Mappings

The mappings object is a parameter (mappings) for an add_documents call. Mappings can be used for granular control over a field. Currently, it is only supported for the multimodal_combination field type.

When creating a structured index you define weights for a multimodal field under dependent fields. When adding documents mappings is optional with structured indexes and is only needed if the user needs to override default multimodal weights defined at index creation time.


Mappings object

Multimodal Combination Mappings

Defining the mapping for multimodal_combination fields:

my_mappings = {
    "my_combination_field": {
        "type": "multimodal_combination",
        "weights": {"My_image": 0.5, "Some_text": 0.5},
    },
    "my_2nd_combination_field": {
        "type": "multimodal_combination",
        "weights": {"Title": -2.5, "Description": 0.3},
    },
}