Configuring indexes

Objective Indexes are configured by a JSON payload containing the values for the different configuration options. The following options are available:

  • Index type - determines the structure of the underlying models & indexes for search
  • Fields - specifies which fields will be indexed, and how

Example configuration

For example, using the Objective Python client you can configure an index as follows:

Configuration(
    index_type=ConfigurationIndexType(
        name="multimodal",
    ),
    fields=ConfigurationFields(
        searchable={
            "allow": [
                "prod_name",
            ],
        },
        crawlable={
            "allow":[
                "image_url"
            ]
        },
        filterable={
            "allow": [
                "department_name",
                "price"
            ]
        },
        types={
            "department_name": "string",
            "price": "int",
        },
    )
)

This configuration will create an index with the following properties:

  • An index type of "multimodal"
  • "prod_name" as a searchable field
  • "image_url" as a crawlable field
  • "department_name" and "price" as filterable fields
  • "department_name" as a string type and "price" as an int type

Index types

There are three Objective index types:

  • text
  • multimodal
  • image

See Index types for more details.

Fields

The "fields" section of the configuration specifies how fields in your Objects are indexed. There are 4 types of fields:

  • searchable - which fields are made available for search
  • crawlable - which fields are crawled and made available for search
  • filterable - which fields are available for filtering and sorting
  • types - specifies the type of the values in the field. Setting a type is required for all non-string filterable fields.

Each of the values in fields accepts an array of string representing the names of the fields in the Objects that you want to assign to that section of the configuration. Fields may appear in multiple sections.

Searchable

The values of fields set as "searchable" will contribute to relevance when searching.

Crawlable

The values of crawlable fields will be crawled and made available for search. For more specifics on the details of crawling, see Crawling.

Filterable

The values of "filterable" fields are able to be filtered on at query time. For more details on filtering see Filtering.

Types

Specifying the type of the field enables the data to be indexed more efficiently, leading to performance gains.

Types are required for all non-string filterable fields.

The following types are supported:

  • string
  • int
  • float
  • bool
  • datetime (we support RFC 3339 formatted dates. For example 2015-11-03T15:01:00.05Z)
  • geo

Data types

Arrays

Array fields are supported. Arrays are "flattened", meaning all of their values are made available in the index independently. For "searchable" fields, all of the values in the array will contribute to relevance. For "filterable" fields all of the values will be filtered upon when a filter is applied to the field. This means if you have and object like:

{
    "values": ["A", "B"]
}

then the following filter will match: filter_query=values:"A".

Nested fields

We support nested fields. Indicate a nested field by using the JSON Path syntax.

Index properties

Immutable

Indexes are immutable by default. If you need to make a change to an index, create a new one. The index will automatically index the required Objects. We cache updates internally, meaning you will not be billed for updates unaffected by the update to the configuration.

FAQs

Can fields appear in multiple sections of the configuration?

Yes, fields may appear in multiple sections of the configuration.

Are crawlable fields also searchable?

Yes, fields specified as "crawlable" do not need to be set in "searchable", their contents will automatically be made searchable.

Was this page helpful?