Skip to content

Commit

Permalink
chore: add in SearchKick default string_template dynamic mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ericenns committed Dec 13, 2024
1 parent 44bb136 commit 649e804
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions app/models/sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,50 @@ class Sample < ApplicationRecord # rubocop:disable Metrics/ClassLength

searchkick \
merge_mappings: true,
mappings: { dynamic_templates: [
{
metadata_dates: {
path_match: 'metadata.*_date',
mapping: {
type: 'date',
ignore_malformed: true
mappings: {
dynamic_templates: [
{
string_template: {
match: '*',
match_mapping_type: 'string',
mapping: {
fields: {
analyzed: {
analyzer: 'searchkick_index',
index: true,
type: 'text'
}
},
ignore_above: 30_000,
type: 'keyword'
}
}
}
}, {
metadata_non_dates: {
path_match: 'metadata.*',
path_unmatch: 'metadata.*_date',
mapping: {
type: 'text',
fields: {
numeric: {
type: 'double',
ignore_malformed: true
},
{
metadata_dates: {
path_match: 'metadata.*_date',
mapping: {
type: 'date',
ignore_malformed: true
}
}
}, {
metadata_non_dates: {
path_match: 'metadata.*',
path_unmatch: 'metadata.*_date',
mapping: {
type: 'text',
fields: {
numeric: {
type: 'double',
ignore_malformed: true
}
}
}
}
}
}
] },
]
},
settings: {
number_of_shards: 1
},
Expand Down

0 comments on commit 649e804

Please sign in to comment.