public function SearchApiElasticsearchConnector::getFieldMapping in Elasticsearch Connector 7
Same name and namespace in other branches
- 7.5 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getFieldMapping()
- 7.2 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getFieldMapping()
Helper function. Get the elasticsearch mapping for a field.
1 call to SearchApiElasticsearchConnector::getFieldMapping()
- SearchApiElasticsearchConnector::fieldsUpdated in modules/
elasticsearch_connector_search_api/ service.inc - Overrides fieldsUpdated().
File
- modules/
elasticsearch_connector_search_api/ service.inc, line 1008 - Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.
Class
- SearchApiElasticsearchConnector
- Search service class.
Code
public function getFieldMapping($field) {
// Support of the custom data types. When such is implemented the type is
// stored in the $field['real_type'] and the $field['type'] contains the
// fallback type that will be used if the custom one is not supported.
$field_type = isset($field['real_type']) ? $field['real_type'] : $field['type'];
$type = search_api_extract_inner_type($field_type);
switch ($type) {
case 'text':
return array(
'type' => 'string',
'boost' => $field['boost'],
);
case 'uri':
case 'string':
case 'token':
return array(
'type' => 'string',
'index' => 'not_analyzed',
);
case 'integer':
case 'duration':
return array(
'type' => 'integer',
);
case 'boolean':
return array(
'type' => 'boolean',
);
case 'decimal':
return array(
'type' => 'float',
);
case 'date':
return array(
'type' => 'date',
'format' => 'date_time',
);
case 'location':
return array(
'type' => 'geo_point',
'lat_lon' => TRUE,
);
default:
return NULL;
}
}