# ANCHORS litheral key: it will not be used as template
# you can store here fragments of structures to reuse below
ANCHORS:
  -

# This is a dynamic index name The settings and mapping below will work with any index.
# The default index name generated by Flex is usually <application_name>_<environment>,
# but you may have changed it in the initializers/flex.rb or you can hardcode it if you prefer.
<%= Flex::Configuration.variables[:index] %>:

  settings:
    number_of_shards: 5
    number_of_replicas: 1
    
    analysis:
      analyzer:
        item_name_index:
          type: custom
          tokenizer: item_name
          filter:
            - lowercase
            - asciifolding
        
        item_name_search:
          type: custom
          tokenizer: keyword
          filter:
            - lowercase
            - asciifolding
      
      tokenizer:
        item_name:
          type: ngram
          min_gram: 3
          max_gram: 16

  # add your custom mappings here
  mappings:
    item:
      properties:
        # Name is an object of locale fields, which are in turn multi_fields.
        # First, an analyzed string for searching. Second, an untouched
        # string for sorting. Elasticsearch requires that both be expliticly
        # named in the mapping, but will handle the copy implicitly.
        name:
          type: object
          properties:
            <% I18n.usable_locales_with_neopets_language_code.each do |locale| %>
            <%= locale %>:
              type: multi_field
              fields:
                <%= locale %>:
                  type: string
                  index: analyzed
                  index_analyzer: item_name_index
                  search_analyzer: item_name_search
                untouched:
                  type: string
                  index: not_analyzed
            <% end %>