Commit dee938f1 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'es_fix' into 'master'

Fix for Elasticsearch::Transport::Transport::Errors::BadRequest: [400]

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21036

See merge request !818
parents 59d18a22 e3b5b46c
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)
- Cache the last usage data to avoid unicorn timeouts
......
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
serialize :original_position, Gitlab::Diff::Position
......
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
serialize :st_diff
......
......@@ -29,6 +29,24 @@ describe Note, elastic: true do
expect(described_class.elastic_search('term', options: options).total_count).to eq(1)
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
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