the first sample working query .. will be modified as per use case
PUT my_index4
{
"settings": {
"analysis": {
"filter": {
"arabic_stop": {
"type": "stop",
"stopwords": "_arabic_"
},
"arabic_keywords": {
"type": "keyword_marker",
"keywords": ["مثال"]
},
"arabic_stemmer": {
"type": "stemmer",
"language": "arabic"
}
},
"analyzer": {
"stemming_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
},
"synonym_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
}
}
}
},
"mappings":{
"blog":{
"properties": {
"title": {
"type": "text",
"fields": {
"exact": {
"type": "text"
},
"synonym": {
"type": "text",
"analyzer": "synonym_analyzer"
},
"stemmed": {
"type": "text",
"analyzer": "stemming_analyzer"
}
}
}
}
}
}
}
original Query:
Doesnt work aboove elasticSearch 2.0
Link: https://stackoverflow.com/questions/28305250/elasticsearch-customize-score-for-synonyms-stemming?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
PUT my_index4
{
"settings": {
"analysis": {
"filter": {
"arabic_stop": {
"type": "stop",
"stopwords": "_arabic_"
},
"arabic_keywords": {
"type": "keyword_marker",
"keywords": ["مثال"]
},
"arabic_stemmer": {
"type": "stemmer",
"language": "arabic"
}
},
"analyzer": {
"stemming_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
},
"synonym_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
}
}
}
},
"mappings":{
"blog":{
"properties": {
"title": {
"type": "text",
"fields": {
"exact": {
"type": "text"
},
"synonym": {
"type": "text",
"analyzer": "synonym_analyzer"
},
"stemmed": {
"type": "text",
"analyzer": "stemming_analyzer"
}
}
}
}
}
}
}
original Query:
Doesnt work aboove elasticSearch 2.0
Link: https://stackoverflow.com/questions/28305250/elasticsearch-customize-score-for-synonyms-stemming?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
PUT /<index_name>/<type_name>/_mapping
{
"<type>": {
"properties": {
"title": {
"type": "string",
"fields": {
"exact": {
"type": "string",
"index": "not_analyzed"
},
"synonym": {
"type": "string",
"index": "analyzed",
"analyzer": "synonym_analyzer"
},
"stemmed": {
"type": "string",
"index": "analyzed",
"analyzer": "stemming_analyzer"
}
}
}
}
}
}
Search
POST /<index_name>/<type_name>/_search
{
"query": {
"multi_match": {
"query": "injury",
"fields": [
"title.exact^3",
"title.synonym^2",
"title.stemmed"
]
}
}
}
Comments
Post a Comment