Commit bf50c890 authored by Valery Sizov's avatar Valery Sizov

[ES indexer] Stabilze indexer when serialized data is corrupted

parent cfe4382e
...@@ -4,7 +4,8 @@ v 8.5.0 (unreleased) ...@@ -4,7 +4,8 @@ v 8.5.0 (unreleased)
- Show warning when mirror repository default branch could not be updated because it has diverged from upstream. - Show warning when mirror repository default branch could not be updated because it has diverged from upstream.
- More reliable wiki indexer - More reliable wiki indexer
- GitLab Pages gets support for custom domain and custom certificate - GitLab Pages gets support for custom domain and custom certificate
- Fix of Elastic indexer. It should not trigger record validation. - Fix of Elastic indexer. It should not trigger record validation for projects
- Fix of Elastic indexer. Stabilze indexer when serialized data is corrupted
v 8.4.4 v 8.4.4
- Re-introduce "Send email to users" link in Admin area - Re-introduce "Send email to users" link in Admin area
......
...@@ -34,13 +34,28 @@ module Elastic ...@@ -34,13 +34,28 @@ module Elastic
end end
def as_indexed_json(options = {}) def as_indexed_json(options = {})
as_json( as_json({
only: [
:id,
:iid,
:target_branch,
:source_branch,
:title,
:description,
:created_at,
:updated_at,
:state,
:merge_status,
:source_project_id,
:target_project_id,
:author_id
],
include: { include: {
source_project: { only: :id }, source_project: { only: :id },
target_project: { only: :id }, target_project: { only: :id },
author: { only: :id } author: { only: :id }
} }
).merge({ updated_at_sort: updated_at }) }).merge({ updated_at_sort: updated_at })
end end
def self.elastic_search(query, options: {}) def self.elastic_search(query, options: {})
......
...@@ -18,7 +18,9 @@ module Elastic ...@@ -18,7 +18,9 @@ module Elastic
end end
def as_indexed_json(options = {}) def as_indexed_json(options = {})
as_json.merge({ updated_at_sort: updated_at }) as_json(
only: [:id, :title, :description, :project_id, :created_at]
).merge({ updated_at_sort: updated_at })
end end
def self.elastic_search(query, options: {}) def self.elastic_search(query, options: {})
......
...@@ -16,7 +16,9 @@ module Elastic ...@@ -16,7 +16,9 @@ module Elastic
end end
def as_indexed_json(options = {}) def as_indexed_json(options = {})
as_json.merge({ updated_at_sort: updated_at }) as_json(
only: [:id, :note, :project_id, :created_at]
).merge({ updated_at_sort: updated_at })
end end
def self.elastic_search(query, options: {}) def self.elastic_search(query, options: {})
......
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