Skip to content
Snippets Groups Projects
Commit bb927920 authored by Valery Sizov's avatar Valery Sizov
Browse files

Merge branch 'elastic_update' into 'master'

Update elastic to 5.1

See merge request !24
parents d64e11e0 a65a96e8
No related branches found
No related tags found
1 merge request!24Update elastic to 5.1
Pipeline #
image: "ruby:2.3"
 
services:
- elasticsearch:latest
- elasticsearch:5.1
 
variables:
ELASTICSEARCH_HOST: "elasticsearch"
Loading
Loading
PATH
remote: .
specs:
gitlab-elasticsearch-git (1.0.0)
gitlab-elasticsearch-git (1.1.0)
activemodel (~> 4.2)
activesupport (~> 4.2)
charlock_holmes (~> 0.7)
Loading
Loading
@@ -22,7 +22,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
builder (3.2.2)
builder (3.2.3)
charlock_holmes (0.7.3)
coderay (1.1.0)
diff-lcs (1.2.5)
Loading
Loading
@@ -95,4 +95,4 @@ DEPENDENCIES
rugged (~> 0.24)
 
BUNDLED WITH
1.12.5
1.13.6
Loading
Loading
@@ -21,55 +21,52 @@ module Elasticsearch
include Elasticsearch::Git::Model
include Elasticsearch::Git::EncoderHelper
 
mapping _timestamp: { enabled: true }, _parent: { type: 'project' } do
mapping _parent: { type: 'project' } do
indexes :blob do
indexes :id, type: :string,
indexes :id, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :rid, type: :string,
index: :not_analyzed
indexes :oid, type: :string,
indexes :rid, type: :keyword
indexes :oid, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :commit_sha, type: :string,
indexes :commit_sha, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :path, type: :string,
indexes :path, type: :text,
analyzer: :path_analyzer
indexes :file_name, type: :string,
indexes :file_name, type: :text,
analyzer: :code_analyzer,
search_analyzer: :code_search_analyzer
indexes :content, type: :string,
indexes :content, type: :text,
index_options: 'offsets',
analyzer: :code_analyzer,
search_analyzer: :code_search_analyzer
indexes :language, type: :string,
index: :not_analyzed
indexes :language, type: :keyword
end
 
indexes :commit do
indexes :id, type: :string,
indexes :id, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :rid, type: :string,
index: :not_analyzed
indexes :sha, type: :string,
indexes :rid, type: :keyword
indexes :sha, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
 
indexes :author do
indexes :name, type: :string, index_options: 'offsets'
indexes :email, type: :string, index_options: 'offsets'
indexes :name, type: :text, index_options: 'offsets'
indexes :email, type: :text, index_options: 'offsets'
indexes :time, type: :date, format: :basic_date_time_no_millis
end
 
indexes :commiter do
indexes :name, type: :string, index_options: 'offsets'
indexes :email, type: :string, index_options: 'offsets'
indexes :name, type: :text, index_options: 'offsets'
indexes :email, type: :text, index_options: 'offsets'
indexes :time, type: :date, format: :basic_date_time_no_millis
end
 
indexes :message, type: :string, index_options: 'offsets'
indexes :message, type: :text, index_options: 'offsets'
end
end
 
Loading
Loading
@@ -465,16 +462,7 @@ module Elasticsearch
 
options[:order] = :default if options[:order].blank?
 
order = case options[:order].to_sym
when :recently_indexed
{ _timestamp: { order: :desc, mode: :min } }
when :last_indexed
{ _timestamp: { order: :asc, mode: :min } }
else
{}
end
query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
query_hash[:sort] = [:_score]
 
res = self.__elasticsearch__.search(query_hash)
{
Loading
Loading
@@ -527,26 +515,16 @@ module Elasticsearch
 
options[:order] = :default if options[:order].blank?
 
order = case options[:order].to_sym
when :recently_indexed
{ _timestamp: { order: :desc, mode: :min } }
when :last_indexed
{ _timestamp: { order: :asc, mode: :min } }
else
{}
end
query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
query_hash[:sort] = [:_score]
 
if options[:highlight]
query_hash[:highlight] = {
pre_tags: ["gitlabelasticsearch→"],
post_tags: ["←gitlabelasticsearch"],
order: "score",
fields: {
"blob.content" => {},
"blob.file_name" => {},
"type" => "fvh",
"boundary_chars" => "\n"
}
}
end
Loading
Loading
module Elasticsearch
module Git
VERSION = '1.0.2'
VERSION = '1.1.0'
end
end
Loading
Loading
@@ -5,7 +5,7 @@ module ElasticHelper
end
 
def remove_index(index_name)
system("curl -XDELETE '#{elastic_url}/#{index_name}/' > /dev/null 2>&1")
system("curl -XDELETE '#{elastic_url}#{index_name}/' > /dev/null 2>&1")
end
 
def elastic_url
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment