Skip to content

Instantly share code, notes, and snippets.

@randsina
Created October 16, 2017 13:26
Show Gist options
  • Save randsina/8bc94bb669752f3e32d31bcd92b1737d to your computer and use it in GitHub Desktop.
Save randsina/8bc94bb669752f3e32d31bcd92b1737d to your computer and use it in GitHub Desktop.
settings(index: {
refresh_interval: '-1',
number_of_shards: '3',
number_of_replicas: '0',
query: {
default_field: 'offer_title'
}
},analysis: {
filter: {
stemming: {
name: 'english',
type: 'stemmer'
},
stopwords: {
type: 'stop',
stopwords: '_english_'
},
synonyms: {
type: 'synonym',
synonyms: [
'refurbished,condition',
'used,condition',
'smartphone=>phone',
'jujube, ju ju be'
]
},
autocomplete_filter: {
type: 'edge_ngram',
min_gram: '1',
max_gram: '20'
}
},
analyzer: {
default: {
filter: [
'standard',
'lowercase',
'stopwords',
'synonyms',
'stemmer'
],
tokenizer: 'standard'
},
didYouMean: {
filter: [
'lowercase',
'stopwords'
],
tokenizer: 'standard'
},
autocomplete_analyzer: {
filter: [
'lowercase',
'autocomplete_filter'
],
type: 'custom',
tokenizer: 'standard'
},
edgeNGramAnalyzer: {
filter: [
'lowercase'
],
tokenizer: 'edgeNGramTokenizer'
}
},
tokenizer: {
edgeNGramTokenizer: {
token_chars: [
'letter',
'digit',
'punctuation'
],
min_gram: '1',
type: 'edgeNGram',
max_gram: '10'
}
}
}
)
COUNT_OF_AGGREGATIONS = 5
define_type DataFeedItem do
root _all: { enabled: false }, dynamic: :strict
field :boost, type: :double
field :category, type: :string do
field :raw, type: :string, index: :not_analyzed
end
field :did_you_mean, type: :string, analyzer: :didYouMean
field :manufacturer, type: :string, copy_to: :did_you_mean, analyzer: :edgeNGramAnalyzer do
field :raw, type: :string, index: :not_analyzed
end
field :merchant, type: :string, copy_to: :did_you_mean do
field :raw, type: :string, index: :not_analyzed
end
field :offer_description, type: :string
field :offer_id, type: :string, index: :no
field :offer_title, type: :string, copy_to: :did_you_mean do
field :autocomplete, type: :string, analyzer: :autocomplete_analyzer, search_analyzer: :standard
end
field :price, type: :double
field :shipping_rate, type: :double
field :source, type: :integer
field :sub_category, type: :string do
field :raw, type: :string, index: :not_analyzed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment