# HEADS UP: the 'variables' node will be removed after parsing!
variables:
  integer_no_index: &integer_no_index
    type: integer
    index: "no"
  keyword_no_index: &keyword_no_index
    type: keyword
    index: "no"

dynamic_templates:
  # properties attached to chunks
  - propsFields:
      path_match: props.*
      mapping:
        type: keyword

# Properties to index
properties:
  # path to the chunk
  path:
    type: keyword
  # tags attached to chunks
  tags:
    type: keyword  # array of keywords actually, auto-supported by Elasticsearch
  # metadata: don't index it
  chunkMeta:
    type: object
    properties:
      start: *integer_no_index
      end: *integer_no_index
      mimeType: *keyword_no_index
      parents:
        type: object
        properties:
          prefix: *keyword_no_index
          localName: *keyword_no_index
          namespacePrefixes: *keyword_no_index
          namespaceUris: *keyword_no_index
          attributePrefixes: *keyword_no_index
          attributeLocalNames: *keyword_no_index
          attributeValues: *keyword_no_index
      parentName: *keyword_no_index
      type: *keyword_no_index

# All fields are part of _source as recommended by:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html

# HEADS UP: the 'variables' node will be removed after parsing!
variables:
  integer_no_index: &integer_no_index
    type: integer
    index: "no"
  keyword_no_index: &keyword_no_index
    type: keyword
    index: "no"

dynamic_templates:
  # properties attached to chunks
  - propsFields:
      path_match: props.*
      mapping:
        numeric_detection: true
        dynamic_date_formats: ["yyyy-MM-ddTHH:mm:ss"]

# Properties to index
properties:
  # path to the chunk
  path:
    type: keyword
  # tags attached to chunks
  tags:
    type: keyword  # array of keywords actually, auto-supported by Elasticsearch
  # metadata: don't index it
  chunkMeta:
    type: object
    properties:
      start: *integer_no_index
      end: *integer_no_index
      mimeType: *keyword_no_index
      parents:
        type: object
        properties:
          prefix: *keyword_no_index
          localName: *keyword_no_index
          namespacePrefixes: *keyword_no_index
          namespaceUris: *keyword_no_index
          attributePrefixes: *keyword_no_index
          attributeLocalNames: *keyword_no_index
          attributeValues: *keyword_no_index
      parentName: *keyword_no_index
      type: *keyword_no_index

# All fields are part of _source as recommended by:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html

Enable date and number detection for properties
Enable date and number detection for properties
