Hi,
I kept following mappings:
PUT pdlfull/pdlfull_type/_mapping
{
"pdlfull_type": {
"properties": {
"GenericDescriptionId": {
"type": "string",
"index": "not_analyzed"
},
"GroupNumber": {
"type": "string",
"index": "not_analyzed"
},
"catalogDescriptions": {
"properties": {
"catalogDescriptionId": {
"type": "long"
}
}
},
"description": {
"type": "string",
"analyzer": "analyzer_startswith",
"fields": {
"sort_field": {
"type": "string",
"analyzer": "keyword_analyzer"
}
}
}
}
And the relevant analyzers I have used in mappings as shown below :
"analysis": {
"analyzer": {
"keyword_analyzer": {
"filter": "lowercase",
"tokenizer": "keyword"
},
"analyzer_startswith": {
"filter": [
"lowercase"
],
"tokenizer": "whitespace"
},
"whitespace_analyzer": {
"type": "custom",
"filter": [
"lowercase",
"asciifolding"
],
"tokenizer": "whitespace"
},
"wordAnalyzer": {
"type": "custom",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
],
"tokenizer": "whitespace"
}
},
"filter": {
"nGram_filter": {
"max_gram": "20",
"min_gram": "1",
"type": "nGram",
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
}
These are the settings I have used,
My sample description field data is(where am searching only in description field) :
"A Frame & Trunnion Kat"
"A/C Bypass pulley"
"A/C Bypass pulley(Belts)"
"A/T Fluid Capacity"
"A/T overdrive Button kit"
"A/T shift bezel"
"Abc accumulator"
"ABS Anti-skid Relay"
"ABS Anti-skid switch"
My Query is:
GET pdlfull/pdlfull_type/_search
{
"query": {
"match_phrase_prefix": {
"description":"a/c b"
}
},
"sort":
{
"description.sort_field"
{
"order":"asc"
}
}
}
The above query is not returning any records.
When am giving the query "a/t s","abc a","a/t f","a/t o","A F" am getting records..
May I know the reason, even am not getting records with few prefixes am unable to find out where the problem is and why my query is behaving differently to different inputs..