-
-
Save GerrBert/39b2e1a30392f32ea2ed5d93b837fbd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// настройки индекса | |
{ | |
"mg1519797048": { | |
"settings": { | |
"index": { | |
"number_of_shards": "3", | |
"provided_name": "mg1519797048", | |
"creation_date": "1519797048441", | |
"analysis": { | |
"filter": { | |
"ru_stemmer": { | |
"type": "stemmer", | |
"language": "russian" | |
}, | |
"g_synonym": { | |
"ignore_case": "true", | |
"type": "synonym", | |
"synonyms": [ | |
"тумбочка, тумба", | |
"мизинчиковые, ааа", | |
"пальчиковые, аа", | |
] | |
}, | |
"g_shingle": { | |
"max_shingle_size": "5", | |
"min_shingle_size": "2", | |
"output_unigrams": "true", | |
"type": "shingle" | |
}, | |
"ru_word_delimiter": { | |
"split_on_numerics": "true", | |
"generate_word_parts": "true", | |
"preserve_original": "false", | |
"catenate_words": "false", | |
"generate_number_parts": "true", | |
"catenate_all": "false", | |
"split_on_case_change": "true", | |
"type": "word_delimiter", | |
"catenate_numbers": "false", | |
"stem_english_possessive": "false" | |
}, | |
"no_stem": { | |
"keywords": [ | |
"белила", | |
"фаил", | |
"аа", | |
"ааа", | |
"aa", | |
"aaa", | |
"силит" | |
], | |
"type": "keyword_marker" | |
} | |
}, | |
"analyzer": { | |
"default": { | |
"filter": [ | |
"asciifolding", | |
"ru_word_delimiter", | |
"lowercase", | |
"g_synonym", | |
"no_stem", | |
"ru_stemmer" | |
], | |
"char_filter": [ | |
"html_strip", | |
"ru_char_filter_e" | |
], | |
"tokenizer": "standard" | |
}, | |
"translit_analyzer": { | |
"filter": [ | |
"asciifolding", | |
"ru_word_delimiter", | |
"lowercase", | |
"g_synonym", | |
"no_stem", | |
"ru_stemmer" | |
], | |
"char_filter": [ | |
"translit_char_filter", | |
"html_strip", | |
"ru_char_filter_e" | |
], | |
"tokenizer": "standard" | |
}, | |
"translit_to_russian_analyzer": { | |
"filter": [ | |
"asciifolding", | |
"ru_word_delimiter", | |
"lowercase", | |
"g_synonym", | |
"no_stem", | |
"ru_stemmer" | |
], | |
"char_filter": [ | |
"translit_to_russian", | |
"html_strip", | |
"ru_char_filter_e" | |
], | |
"tokenizer": "standard" | |
}, | |
"shingle_analyzer": { | |
"filter": [ | |
"asciifolding", | |
"ru_word_delimiter", | |
"lowercase", | |
"g_synonym", | |
"no_stem", | |
"ru_stemmer", | |
"g_shingle" | |
], | |
"char_filter": [ | |
"html_strip", | |
"ru_char_filter_e" | |
], | |
"tokenizer": "standard" | |
}, | |
"convert_keyboard_analyzer": { | |
"filter": [ | |
"asciifolding", | |
"ru_word_delimiter", | |
"lowercase", | |
"g_synonym", | |
"no_stem", | |
"ru_stemmer" | |
], | |
"char_filter": [ | |
"convert_keyboard_char_filter", | |
"html_strip", | |
"ru_char_filter_e" | |
], | |
"tokenizer": "standard" | |
} | |
}, | |
"char_filter": { | |
"convert_keyboard_char_filter": { | |
"type": "mapping", | |
"mappings": [ | |
"a => ф", | |
"b => и", | |
"c => с", | |
"d => в", | |
"e => у", | |
"f => а", | |
"g => п", | |
"h => р", | |
"i => ш", | |
"j => о", | |
"k => л", | |
"l => д", | |
"m => ь", | |
"n => т", | |
"o => щ", | |
"p => з", | |
"q => й", | |
"r => к", | |
"s => ы", | |
"t => е", | |
"u => г", | |
"v => м", | |
"w => ц", | |
"x => ч", | |
"y => н", | |
"z => я", | |
"A => Ф", | |
"B => И", | |
"C => С", | |
"D => В", | |
"E => У", | |
"F => А", | |
"G => П", | |
"H => Р", | |
"I => Ш", | |
"J => О", | |
"K => Л", | |
"L => Д", | |
"M => Ь", | |
"N => Т", | |
"O => Щ", | |
"P => З", | |
"Q => Й", | |
"R => К", | |
"S => Ы", | |
"T => Е", | |
"U => Г", | |
"V => М", | |
"W => Ц", | |
"X => Ч", | |
"Y => Н", | |
"Z => Я", | |
"[ => х", | |
"] => ъ", | |
"{ => Х", | |
"} => Ъ", | |
"; => ж", | |
": => Ж", | |
"' => э", | |
"\" => Э", | |
", => б", | |
". => ю", | |
"< => Б", | |
"> => Ю", | |
"/ => .", | |
"? => ,", | |
"ф => a", | |
"и => b", | |
"с => c", | |
"в => d", | |
"у => e", | |
"а => f", | |
"п => g", | |
"р => h", | |
"ш => i", | |
"о => j", | |
"л => k", | |
"д => l", | |
"ь => m", | |
"т => n", | |
"щ => o", | |
"з => p", | |
"й => q", | |
"к => r", | |
"ы => s", | |
"е => t", | |
"г => u", | |
"м => v", | |
"ц => w", | |
"ч => x", | |
"н => y", | |
"я => z", | |
"Ф => A", | |
"И => B", | |
"С => C", | |
"В => D", | |
"У => E", | |
"А => F", | |
"П => G", | |
"Р => H", | |
"Ш => I", | |
"О => J", | |
"Л => K", | |
"Д => L", | |
"Ь => M", | |
"Т => N", | |
"Щ => O", | |
"З => P", | |
"Й => Q", | |
"К => R", | |
"Ы => S", | |
"Е => T", | |
"Г => U", | |
"М => V", | |
"Ц => W", | |
"Ч => X", | |
"Н => Y", | |
"Я => Z", | |
"х => [", | |
"ъ => ]", | |
"Х => {", | |
"Ъ => }", | |
"ж => ;", | |
"Ж => :", | |
"э => '", | |
"Э => \"", | |
"б => ," | |
] | |
}, | |
"ru_char_filter_i": { | |
"type": "mapping", | |
"mappings": [ | |
"й => и", | |
"Й => И" | |
] | |
}, | |
"translit_to_russian": { | |
"type": "mapping", | |
"mappings": [ | |
"ae => е", | |
"a => а", | |
"b => б", | |
"ch => ч", | |
"ck => к", | |
"ca => ка", | |
"ci => си", | |
"c => к", | |
"d => д", | |
"ee => и", | |
"e => е", | |
"f => ф", | |
"g => г", | |
"h => х", | |
"i => и", | |
"j => ж", | |
"k => к", | |
"ll => л", | |
"l => л", | |
"mm => м", | |
"m => м", | |
"n => н", | |
"oo => y", | |
"ou => о", | |
"o => о", | |
"ph => ф", | |
"p => п", | |
"qu => кв", | |
"q => к", | |
"r => р", | |
"sh => ш", | |
"ss => с", | |
"s => с", | |
"tt => т", | |
"t => т", | |
"u => у", | |
"v => в", | |
"w => в", | |
"x => кс", | |
"y => й", | |
"z => з", | |
"AE => Е", | |
"A => А", | |
"B => Б", | |
"CH => Ч", | |
"CK => К", | |
"CA => КА", | |
"CI => СИ", | |
"C => К", | |
"D => Д", | |
"E => Е", | |
"EE => И", | |
"F => Ф", | |
"G => Г", | |
"H => Х", | |
"I => И", | |
"J => Ж", | |
"K => К", | |
"LL => Л", | |
"L => Л", | |
"MM => М", | |
"M => М", | |
"N => Н", | |
"OO => У", | |
"OU => О", | |
"O => О", | |
"PH => Ф", | |
"P => П", | |
"QU => КВ", | |
"Q => К", | |
"R => Р", | |
"SH => Ш", | |
"SS => С", | |
"S => С", | |
"TT => Т", | |
"T => Т", | |
"U => У", | |
"V => В", | |
"W => В", | |
"X => КС", | |
"Y => Й", | |
"Z => З" | |
] | |
}, | |
"ru_char_filter_e": { | |
"type": "mapping", | |
"mappings": [ | |
"ё => е", | |
"Ё => Е" | |
] | |
}, | |
"translit_char_filter": { | |
"type": "mapping", | |
"mappings": [ | |
"a => а", | |
"b => б", | |
"c => ц", | |
"d => д", | |
"e => е", | |
"f => ф", | |
"g => г", | |
"h => х", | |
"i => и", | |
"j => ж", | |
"k => к", | |
"l => л", | |
"m => м", | |
"n => н", | |
"o => о", | |
"p => п", | |
"q => к", | |
"r => р", | |
"s => с", | |
"t => т", | |
"u => у", | |
"v => в", | |
"w => в", | |
"x => кс", | |
"y => й", | |
"z => з", | |
"A => А", | |
"B => Б", | |
"C => Ц", | |
"D => Д", | |
"E => Е", | |
"F => Ф", | |
"G => Г", | |
"H => Х", | |
"I => И", | |
"J => Ж", | |
"K => К", | |
"L => Л", | |
"M => М", | |
"N => Н", | |
"O => О", | |
"P => П", | |
"Q => К", | |
"R => Р", | |
"S => С", | |
"T => Т", | |
"U => У", | |
"V => В", | |
"W => В", | |
"X => КС", | |
"Y => Й", | |
"Z => З", | |
"ф => f", | |
"и => i", | |
"с => s", | |
"в => v", | |
"у => u", | |
"а => a", | |
"п => p", | |
"р => r", | |
"ш => sh", | |
"о => o", | |
"л => l", | |
"д => d", | |
"ь => '", | |
"Ь => '", | |
"ъ => '", | |
"Ъ => '", | |
"т => t", | |
"щ => sh", | |
"з => z", | |
"й => y", | |
"к => k", | |
"ы => y", | |
"е => e", | |
"г => g", | |
"м => m", | |
"ц => c", | |
"ч => ch", | |
"н => n", | |
"я => ya", | |
"Ф => F", | |
"И => I", | |
"С => S", | |
"В => V", | |
"У => U", | |
"А => A", | |
"П => P", | |
"Р => R", | |
"Ш => SH", | |
"О => O", | |
"Л => L", | |
"Д => D", | |
"Т => T", | |
"Щ => SH", | |
"З => Z", | |
"Й => J", | |
"К => K", | |
"Ы => Y", | |
"Е => E", | |
"Г => G", | |
"М => M", | |
"Ц => C", | |
"Ч => CH", | |
"Н => N", | |
"Я => YA", | |
"х => h", | |
"Х => H", | |
"ж => j", | |
"Ж => J", | |
"э => e", | |
"Э => E", | |
"б => b", | |
"Б => B", | |
"ю => u", | |
"Ю => U" | |
] | |
} | |
} | |
}, | |
"number_of_replicas": "2", | |
"uuid": "cShjVrfKT864WNNSOBTH6w", | |
"version": { | |
"created": "5040099", | |
"upgraded": "5060299" | |
} | |
} | |
} | |
} | |
} | |
// маппинг индекса | |
{ | |
"mg1519797048": { | |
"mappings": { | |
"products": { | |
"properties": { | |
"ACTIONS": { | |
"type": "keyword", | |
"store": true, | |
"include_in_all": false | |
}, | |
"ARTICLE": { | |
"type": "text", | |
"norms": false, | |
"fields": { | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"BRAND": { | |
"type": "keyword", | |
"store": true, | |
"fields": { | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"CHARACTERISTIC": { | |
"type": "text", | |
"norms": false, | |
"fields": { | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"DATE_CREATE": { | |
"type": "date", | |
"index": false | |
}, | |
"FACETS": { | |
"type": "keyword", | |
"store": true, | |
"include_in_all": false | |
}, | |
"IDP": { | |
"type": "keyword", | |
"store": true, | |
"include_in_all": false | |
}, | |
"MAKER": { | |
"type": "keyword", | |
"store": true | |
}, | |
"MULTIPLIER": { | |
"type": "integer", | |
"index": false, | |
"store": true | |
}, | |
"NAME": { | |
"type": "text", | |
"norms": false, | |
"fields": { | |
"raw": { | |
"type": "keyword" | |
}, | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"SECTION": { | |
"type": "integer", | |
"index": false, | |
"store": true | |
}, | |
"SECTIONS": { | |
"type": "integer", | |
"store": true, | |
"include_in_all": false | |
}, | |
"SECTION_TAGS": { | |
"type": "text", | |
"norms": false, | |
"fields": { | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"STOCK": { | |
"include_in_all": false, | |
"properties": { | |
"16": { | |
"type": "long" | |
}, | |
"17": { | |
"type": "long" | |
}, | |
"18": { | |
"type": "long" | |
}, | |
"19": { | |
"type": "long" | |
}, | |
"22": { | |
"type": "long" | |
}, | |
"23": { | |
"type": "long" | |
}, | |
"24": { | |
"type": "long" | |
}, | |
"25": { | |
"type": "long" | |
}, | |
"26": { | |
"type": "long" | |
}, | |
"27": { | |
"type": "long" | |
}, | |
"35": { | |
"type": "long" | |
} | |
} | |
}, | |
"TAGS": { | |
"type": "text", | |
"norms": false, | |
"fields": { | |
"shingle": { | |
"type": "text", | |
"analyzer": "shingle_analyzer" | |
}, | |
"translit": { | |
"type": "text", | |
"analyzer": "translit_analyzer" | |
}, | |
"translit_ru": { | |
"type": "text", | |
"analyzer": "translit_to_russian_analyzer" | |
} | |
} | |
}, | |
"XML_ID": { | |
"type": "integer", | |
"store": true | |
} | |
} | |
}, | |
} | |
} | |
} | |
// параметры запроса | |
{ | |
'sort': { | |
'_score': 'desc' | |
}, | |
'from': 0, | |
'size': '20', | |
'query': { | |
'bool': { | |
'should': [ | |
{ | |
'bool': { | |
'must': { | |
'function_score': { | |
'query': { | |
'bool': { | |
'must': [ | |
{ | |
'simple_query_string': { | |
'query': 'бумага для диспенсера', | |
'default_operator': 'AND', | |
'analyzer': 'default', | |
'fields': [ | |
'NAME^4', | |
'BRAND^2', | |
'TAGS^2', | |
'SECTION_TAGS^3', | |
'NAME.translit^4', | |
'BRAND.translit^2', | |
'TAGS.translit^2', | |
'SECTION_TAGS.translit^3', | |
'NAME.translit_ru^4', | |
'BRAND.translit_ru^2', | |
'TAGS.translit_ru^2', | |
'SECTION_TAGS.translit_ru^3', | |
'NAME.shingle^4', | |
'BRAND.shingle^2', | |
'TAGS.shingle^2', | |
'SECTION_TAGS.shingle^3', | |
'_all' | |
] | |
} | |
} | |
], | |
'filter': [ | |
{ | |
'term': { | |
'IDP': 'of' | |
} | |
} | |
] | |
} | |
}, | |
'script_score': { | |
'script': '400000 + _score * (1 + 0.05 * doc[\'MULTIPLIER\'].value)' | |
} | |
} | |
} | |
} | |
}, | |
{ | |
'bool': { | |
'must': { | |
'function_score': { | |
'query': { | |
'bool': { | |
'must': [ | |
{ | |
'simple_query_string': { | |
'query': 'бумага для диспенсера', | |
'default_operator': 'AND', | |
'analyzer': 'convert_keyboard_analyzer', | |
'fields': [ | |
'NAME^4', | |
'BRAND^2', | |
'TAGS^2', | |
'SECTION_TAGS^3', | |
'NAME.translit^4', | |
'BRAND.translit^2', | |
'TAGS.translit^2', | |
'SECTION_TAGS.translit^3', | |
'NAME.translit_ru^4', | |
'BRAND.translit_ru^2', | |
'TAGS.translit_ru^2', | |
'SECTION_TAGS.translit_ru^3', | |
'NAME.shingle^4', | |
'BRAND.shingle^2', | |
'TAGS.shingle^2', | |
'SECTION_TAGS.shingle^3', | |
'_all' | |
] | |
} | |
} | |
], | |
'filter': [ | |
{ | |
'term': { | |
'IDP': 'of' | |
} | |
} | |
] | |
} | |
}, | |
'script_score': { | |
'script': '30000 + _score * (1 + 0.05 * doc[\'MULTIPLIER\'].value)' | |
} | |
} | |
} | |
} | |
}, | |
{ | |
'bool': { | |
'must': { | |
'function_score': { | |
'query': { | |
'bool': { | |
'must': [ | |
{ | |
'match_phrase': { | |
'NAME': 'бумага для диспенсера' | |
} | |
} | |
], | |
'filter': [ | |
{ | |
'term': { | |
'IDP': 'of' | |
} | |
} | |
] | |
} | |
}, | |
'script_score': { | |
'script': '100000 + _score * (1 + 0.05 * doc[\'MULTIPLIER\'].value)' | |
} | |
} | |
} | |
} | |
} | |
], | |
'minimum_should_match': 1 | |
} | |
}, | |
'_source': [ | |
'XML_ID', | |
'BRAND', | |
'NAME', | |
'SECTIONS' | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment