Skip to content

Commit 1be83ba

Browse files
committed
Include suggestions from code review
Fixes #826
1 parent 184ae36 commit 1be83ba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spec/es_spec_helper.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ def todays_date
3030
Time.now.strftime("%Y.%m.%d")
3131
end
3232

33-
def mapping_name
33+
34+
def default_mapping_from_mappings(mappings)
3435
if ESHelper.es_version_satisfies?(">=7")
35-
nil
36+
mappings
3637
else
37-
"_default_"
38+
mappings["_default_"]
3839
end
3940
end
4041

4142
def field_properties_from_template(template_name, field)
4243
mappings = @es.indices.get_template(name: template_name)[template_name]["mappings"]
43-
(mapping_name.nil?) ? mappings["properties"][field]["properties"] : mappings[mapping_name]["properties"][field]["properties"]
44+
mapping = default_mapping_from_mappings(mappings)
45+
mapping["properties"][field]["properties"]
4446
end
4547

4648
def routing_field_name

0 commit comments

Comments
 (0)