On a field I want to set a custom analyzer which has custom filters - with a focus on stemming - so "flash cards" and "flash card" are stemmed to same roots and so return same results
When I run the following query I get hits (great), but "flash cards" and "flash card" each return different results:
{"query_string": {
"fields": ["description"],
"query": query
}
}
but when I run the following query I get no results :
{"query_string": {
"fields": ["description.analyzed"],
"query": query
}
}
Looking at my mapping below, we see that description.analyzed
and description
have the same config - so each field should behave the same, and stemming should happen?
How can I be sure that the analyzer is being used?
my mappings for the index:
{'mappings': {
'file': { # doc_type
'properties': { # properties for doc_type
'description': { # field called description
'type': 'multi_field', # to allow "sub fields" with different alalysers
'fields': {
'description': {'type': 'string', 'analyzer': 'my_analyser'},
'analysed': {'type': 'string', 'analyzer': 'my_analyser'}
}
},
}
}
},
'settings': {
'analysis': {
'filter': { #declare my custin filters
'filter_ngrams': {'max_gram': 5, 'min_gram': 1, 'type': 'edgeNGram'},
'filter_stop':{'type':'stop', 'enable_position_increments': 'false'},
'filter_shingle':{'type': 'shingle', 'max_shingle_size': 5, 'min_shingle_size': 2, 'output_unigrams':'true'},
'filter_stemmer' : {'type': 'stemmer', 'name': 'english'}
},
'analyzer': { # declare custom analyzers
'my_analyser': {
'filter': ['standard', 'lowercase', 'asciifolding', 'filter_stop', 'filter_shingle', 'filter_stemmer'],
'type': 'custom',
'tokenizer': 'standard'
},
}
}
}
}