def save(self):
        """
            Creates this index in the collection if it hasn't been already created
        """

        api = Client.instance().api

        index_details = {
            'type': self.index_type_obj.type_name
        }

        extra_index_attributes = self.index_type_obj.get_extra_attributes()

        for extra_attribute_key in extra_index_attributes:
            extra_attribute_value = extra_index_attributes[extra_attribute_key]
            index_details[extra_attribute_key] = extra_attribute_value

        query_parameters = {
            'collection': self.collection.name,
        }

        result = api.index.post(data=index_details, **query_parameters)

        self.index_type_obj.is_new = result['isNewlyCreated']
        self.index_type_obj.id = result['id']
def save ( self ) : api = Client . instance ( ) . api index_details = { 'type' : self . index_type_obj . type_name } extra_index_attributes = self . index_type_obj . get_extra_attributes ( ) for extra_attribute_key in extra_index_attributes : extra_attribute_value = extra_index_attributes [ extra_attribute_key ] index_details [ extra_attribute_key ] = extra_attribute_value query_parameters = { 'collection' : self . collection . name , } result = api . index . post ( data = index_details , ** query_parameters ) self . index_type_obj . is_new = result [ 'isNewlyCreated' ] self . index_type_obj . id = result [ 'id' ]
Creates this index in the collection if it hasn't been already created