   "Number of shards to use for the services index."
   {:default 5 :type Long})
 
+(defconfig elastic-autocomplete-index-num-shards
+  "Number of shards to use for the autocomplete index"
+  {:default 5 :type Long})
+
 (defconfig collections-index-alias
   "The alias to use for the collections index."
   {:default "collection_search_alias" :type String})

   :tag-key.lowercase (-> m/string-field-mapping m/stored m/doc-values)
   :description (m/not-indexed (m/stored m/string-field-mapping))
   :originator-id.lowercase (m/stored m/string-field-mapping)})

(defmapping variable-mapping :variable
  "Defines the elasticsearch mapping for storing variables. These are the

                        :number_of_replicas 1,
                        :refresh_interval "1s"}})

(def autocomplete-settings {:index
                            {:number_of_shards (elastic-autocomplete-index-num-shards)
                             :number_of_replicas 1
                             :refresh_interval "1s"}
                           :analysis
                            {:filter
                             {:autocomplete_filter
                              {:type "edge_ngram"
                               :min_gram 1
                               :max_gram 8}}
                             :analyzer
                             {:autocomplete_analyzer
                              {:type "custom"
                               :tokenizer "standard"
                               :filter ["lowercase" "autocomplete_filter"]}}}})

(def service-setting {:index
                       {:number_of_shards (elastic-service-index-num-shards)
                        :number_of_replicas 1,
                        :refresh_interval "1s"}})


(defnestedmapping attributes-field-mapping
  "Defines mappings for attributes."
