You are here

function elasticsearch_connector_statistics_get_mapping in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module \elasticsearch_connector_statistics_get_mapping()
  2. 7 modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module \elasticsearch_connector_statistics_get_mapping()

Default index mapping for the elasticsearch watchdog index.

Parameters

integer $ttl: Time To Live setting.

Return value

array The mapping index array.

1 call to elasticsearch_connector_statistics_get_mapping()
elasticsearch_connector_statistics_create_type in modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module
Create Elasticsearch connector statistics type.

File

modules/elasticsearch_connector_statistics/elasticsearch_connector_statistics.module, line 347
Logs and displays access statistics for a site.

Code

function elasticsearch_connector_statistics_get_mapping($ttl = NULL) {
  if (!isset($ttl)) {
    $ttl = variable_get('elasticsearch_connector_statistics_ttl', ELASTICSEARCH_CONNECTOR_STATS_DEFAULT_INTERVAL);
  }

  // Index Mapping
  $my_type_mapping = array(
    '_source' => array(
      'enabled' => TRUE,
    ),
    '_all' => array(
      'enabled' => TRUE,
    ),
    '_ttl' => array(
      'enabled' => TRUE,
      'default' => $ttl,
    ),
    'properties' => array(
      'title' => array(
        'type' => 'string',
      ),
      'path' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'domain' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'ip' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'uid' => array(
        'type' => 'long',
      ),
      'timestamp' => array(
        'type' => 'date',
      ),
      'username' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'page_language' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'referer' => array(
        'type' => 'string',
        'index' => 'not_analyzed',
      ),
      'entity' => array(
        'type' => 'object',
      ),
    ),
  );

  // Alter the mapping if necessary.
  drupal_alter('elasticsearch_connector_statistics_get_mapping', $my_type_mapping);
  return $my_type_mapping;
}