Commit e3b5b46c authored by Valery Sizov's avatar Valery Sizov

Fix Elasticsearch::Transport::Transport::Errors::BadRequest

parent cea77efe
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
## 8.13.1
- Fix Elasticsearch::Transport::Transport::Errors::BadRequest when ES is enabled. #21036
## 8.13.0 (2016-10-22) ## 8.13.0 (2016-10-22)
- Cache the last usage data to avoid unicorn timeouts - Cache the last usage data to avoid unicorn timeouts
......
class DiffNote < Note class DiffNote < Note
# Elastic search configuration (it does not support STI properly)
document_type 'note'
index_name [Rails.application.class.parent_name.downcase, Rails.env].join('-')
include Elastic::NotesSearch
include NoteOnDiff include NoteOnDiff
serialize :original_position, Gitlab::Diff::Position serialize :original_position, Gitlab::Diff::Position
......
class LegacyDiffNote < Note class LegacyDiffNote < Note
# Elastic search configuration (it does not support STI properly)
document_type 'note'
index_name [Rails.application.class.parent_name.downcase, Rails.env].join('-')
include Elastic::NotesSearch
include NoteOnDiff include NoteOnDiff
serialize :st_diff serialize :st_diff
......
...@@ -29,6 +29,24 @@ describe Note, elastic: true do ...@@ -29,6 +29,24 @@ describe Note, elastic: true do
expect(described_class.elastic_search('term', options: options).total_count).to eq(1) expect(described_class.elastic_search('term', options: options).total_count).to eq(1)
end end
it "indexes && searches diff notes" do
notes = []
Sidekiq::Testing.inline! do
notes << create(:diff_note_on_merge_request, note: "term")
notes << create(:diff_note_on_commit, note: "term")
notes << create(:legacy_diff_note_on_merge_request, note: "term")
notes << create(:legacy_diff_note_on_commit, note: "term")
Gitlab::Elastic::Helper.refresh_index
end
project_ids = notes.map { |note| note.noteable.project.id }
options = { project_ids: project_ids }
expect(described_class.elastic_search('term', options: options).total_count).to eq(4)
end
it "returns json with all needed elements" do it "returns json with all needed elements" do
note = create :note note = create :note
......
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