Commit ce18fdd9 authored by Valery Sizov's avatar Valery Sizov

ES: optimize an index

parent 68b583ef
......@@ -10,35 +10,16 @@ module ApplicationSearch
settings \
index: {
query: {
default_field: :name
},
analysis: {
analyzer: {
my_analyzer:{
type: "custom",
tokenizer: "ngram_tokenizer",
filter: %w(lowercase asciifolding name_ngrams)
},
search_analyzer: {
type: "custom",
default:{
tokenizer: "standard",
filter: %w(lowercase asciifolding)
filter: ["standard", "lowercase", "my_stemmer"]
}
},
tokenizer: {
ngram_tokenizer: {
type: "nGram",
min_gram: 1,
max_gram: 20,
token_chars: %w(letter digit connector_punctuation punctuation)
}
},
filter: {
name_ngrams: {
type: "nGram",
max_gram: 20,
min_gram: 1
my_stemmer: {
type: "stemmer",
name: "light_german"
}
}
}
......
......@@ -9,13 +9,9 @@ module IssuesSearch
indexes :iid, type: :integer, index: :not_analyzed
indexes :title, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :description, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :created_at, type: :date
indexes :updated_at, type: :date
indexes :state, type: :string
......
......@@ -9,21 +9,14 @@ module MergeRequestsSearch
indexes :iid, type: :integer
indexes :target_branch, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
index_options: 'offsets'
analyzer: :my_analyzer
indexes :source_branch, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :title, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :description, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :created_at, type: :date
indexes :updated_at, type: :date
indexes :state, type: :string
......
......@@ -7,13 +7,9 @@ module MilestonesSearch
mappings do
indexes :id, type: :integer
indexes :title, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :description, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :project_id, type: :integer
indexes :created_at, type: :date
......
......@@ -7,9 +7,7 @@ module NotesSearch
mappings do
indexes :id, type: :integer
indexes :note, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :project_id, type: :integer
indexes :created_at, type: :date
......
......@@ -8,25 +8,15 @@ module ProjectsSearch
indexes :id, type: :integer
indexes :name, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :path, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :name_with_namespace, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :path_with_namespace, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :description, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :namespace_id, type: :integer
......
......@@ -8,17 +8,11 @@ module SnippetsSearch
indexes :id, type: :integer
indexes :title, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :file_name, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :content, type: :string,
index_options: 'offsets',
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
index_options: 'offsets'
indexes :created_at, type: :date
indexes :updated_at, type: :date
indexes :state, type: :string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment