Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
48df9d30
Commit
48df9d30
authored
Nov 16, 2020
by
Dmitry Gruzd
Committed by
Vitali Tatarintev
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix create_migrations_index for ES6
parent
fea3a72b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
ee/changelogs/unreleased/fix-es-migrations-for-es6.yml
ee/changelogs/unreleased/fix-es-migrations-for-es6.yml
+5
-0
ee/lib/gitlab/elastic/helper.rb
ee/lib/gitlab/elastic/helper.rb
+21
-15
No files found.
ee/changelogs/unreleased/fix-es-migrations-for-es6.yml
0 → 100644
View file @
48df9d30
---
title
:
Fix create_migrations_index for ES6
merge_request
:
47651
author
:
type
:
fixed
ee/lib/gitlab/elastic/helper.rb
View file @
48df9d30
...
@@ -59,9 +59,11 @@ module Gitlab
...
@@ -59,9 +59,11 @@ module Gitlab
def
create_migrations_index
def
create_migrations_index
settings
=
{
number_of_shards:
1
}
settings
=
{
number_of_shards:
1
}
mappings
=
{
mappings
=
{
properties:
{
_doc:
{
completed:
{
properties:
{
type:
'boolean'
completed:
{
type:
'boolean'
}
}
}
}
}
}
}
...
@@ -72,7 +74,7 @@ module Gitlab
...
@@ -72,7 +74,7 @@ module Gitlab
settings:
settings
.
to_hash
,
settings:
settings
.
to_hash
,
mappings:
mappings
.
to_hash
mappings:
mappings
.
to_hash
}
}
}
}
.
merge
(
additional_index_options
)
client
.
indices
.
create
create_index_options
client
.
indices
.
create
create_index_options
...
@@ -98,17 +100,7 @@ module Gitlab
...
@@ -98,17 +100,7 @@ module Gitlab
settings:
settings
.
to_hash
,
settings:
settings
.
to_hash
,
mappings:
mappings
.
to_hash
mappings:
mappings
.
to_hash
}
}
}
}.
merge
(
additional_index_options
)
# include_type_name defaults to false in ES7. This will ensure ES7
# behaves like ES6 when creating mappings. See
# https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0
# for more information. We also can't set this for any versions before
# 6.8 as this parameter was not supported. Since it defaults to true in
# all 6.x it's safe to only set it for 7.x.
if
Gitlab
::
VersionInfo
.
parse
(
client
.
info
[
'version'
][
'number'
]).
major
==
7
create_index_options
[
:include_type_name
]
=
true
end
client
.
indices
.
create
create_index_options
client
.
indices
.
create
create_index_options
client
.
indices
.
put_alias
(
name:
target_name
,
index:
new_index_name
)
if
with_alias
client
.
indices
.
put_alias
(
name:
target_name
,
index:
new_index_name
)
if
with_alias
...
@@ -208,6 +200,20 @@ module Gitlab
...
@@ -208,6 +200,20 @@ module Gitlab
target_name
target_name
end
end
end
end
private
def
additional_index_options
{}.
tap
do
|
options
|
# include_type_name defaults to false in ES7. This will ensure ES7
# behaves like ES6 when creating mappings. See
# https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0
# for more information. We also can't set this for any versions before
# 6.8 as this parameter was not supported. Since it defaults to true in
# all 6.x it's safe to only set it for 7.x.
options
[
:include_type_name
]
=
true
if
Gitlab
::
VersionInfo
.
parse
(
client
.
info
[
'version'
][
'number'
]).
major
==
7
end
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment