Commit ce18fdd9 authored by Valery Sizov's avatar Valery Sizov

ES: optimize an index

parent 68b583ef
...@@ -10,35 +10,16 @@ module ApplicationSearch ...@@ -10,35 +10,16 @@ module ApplicationSearch
settings \ settings \
index: { index: {
query: {
default_field: :name
},
analysis: { analysis: {
analyzer: { analyzer: {
my_analyzer:{ default:{
type: "custom",
tokenizer: "ngram_tokenizer",
filter: %w(lowercase asciifolding name_ngrams)
},
search_analyzer: {
type: "custom",
tokenizer: "standard", 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: { filter: {
name_ngrams: { my_stemmer: {
type: "nGram", type: "stemmer",
max_gram: 20, name: "light_german"
min_gram: 1
} }
} }
} }
......
...@@ -9,13 +9,9 @@ module IssuesSearch ...@@ -9,13 +9,9 @@ module IssuesSearch
indexes :iid, type: :integer, index: :not_analyzed indexes :iid, type: :integer, index: :not_analyzed
indexes :title, type: :string, indexes :title, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :description, type: :string, indexes :description, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :created_at, type: :date indexes :created_at, type: :date
indexes :updated_at, type: :date indexes :updated_at, type: :date
indexes :state, type: :string indexes :state, type: :string
......
...@@ -9,21 +9,14 @@ module MergeRequestsSearch ...@@ -9,21 +9,14 @@ module MergeRequestsSearch
indexes :iid, type: :integer indexes :iid, type: :integer
indexes :target_branch, type: :string, indexes :target_branch, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer analyzer: :my_analyzer
indexes :source_branch, type: :string, indexes :source_branch, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :title, type: :string, indexes :title, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :description, type: :string, indexes :description, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :created_at, type: :date indexes :created_at, type: :date
indexes :updated_at, type: :date indexes :updated_at, type: :date
indexes :state, type: :string indexes :state, type: :string
......
...@@ -7,13 +7,9 @@ module MilestonesSearch ...@@ -7,13 +7,9 @@ module MilestonesSearch
mappings do mappings do
indexes :id, type: :integer indexes :id, type: :integer
indexes :title, type: :string, indexes :title, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :description, type: :string, indexes :description, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :project_id, type: :integer indexes :project_id, type: :integer
indexes :created_at, type: :date indexes :created_at, type: :date
......
...@@ -7,9 +7,7 @@ module NotesSearch ...@@ -7,9 +7,7 @@ module NotesSearch
mappings do mappings do
indexes :id, type: :integer indexes :id, type: :integer
indexes :note, type: :string, indexes :note, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :project_id, type: :integer indexes :project_id, type: :integer
indexes :created_at, type: :date indexes :created_at, type: :date
......
...@@ -8,25 +8,15 @@ module ProjectsSearch ...@@ -8,25 +8,15 @@ module ProjectsSearch
indexes :id, type: :integer indexes :id, type: :integer
indexes :name, type: :string, indexes :name, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :path, type: :string, indexes :path, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :name_with_namespace, type: :string, indexes :name_with_namespace, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :path_with_namespace, type: :string, indexes :path_with_namespace, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :description, type: :string, indexes :description, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :namespace_id, type: :integer indexes :namespace_id, type: :integer
......
...@@ -8,17 +8,11 @@ module SnippetsSearch ...@@ -8,17 +8,11 @@ module SnippetsSearch
indexes :id, type: :integer indexes :id, type: :integer
indexes :title, type: :string, indexes :title, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :file_name, type: :string, indexes :file_name, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :content, type: :string, indexes :content, type: :string,
index_options: 'offsets', index_options: 'offsets'
search_analyzer: :search_analyzer,
analyzer: :my_analyzer
indexes :created_at, type: :date indexes :created_at, type: :date
indexes :updated_at, type: :date indexes :updated_at, type: :date
indexes :state, type: :string 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