Phrase suggester is behaving differently


(anusha) #1

Hi,
My phrase is not giving any results if the ast_type have field priority, but when the same type ast_type without the field priority phrase_suggester is providing results...

Am having the fields as shown in the mapping:

"ast": {
"mappings": {
"ast_type": {
"properties": {
"id": {
"type": "string",
"analyzer": "analyzer_startswith"
},
"name": {
"type": "string",
"analyzer": "keyword_analyzer"
},
"priority": {
"type": "long"
}
}
}
}
}

And the respective analyzers:

"keyword_analyzer": {
"filter": "lowercase",
"tokenizer": "keyword"
},
"analyzer_startswith": {
"filter": [
"lowercase"
],
"tokenizer": "whitespace"
}

Am using the query:

GET ast/ast_type/_search
{
"size": 0,
"suggest": {
"did-you-mean": {
"text": "engina",
"phrase": {
"field": "id",
"size": 3,
"direct_generator": [
{
"field": "id",
"suggest_mode": "always",
"post_filter": "standard"
}
]
}
}
}
}

Output to the above request:

"suggest": {
"did-you-mean": [
{
"text": "engina",
"offset": 0,
"length": 6,
"options": []
}
]
}

And the relevant sample data I have in the ast index :
"_source": {
"id": "engine oil",
"priority": 1,
"name": "engine oil"
}
"_source": {
"id": "engine heater",
"priority": 3,
"name": "engine heater"
}

If I use the data without priority field as shown in the sample data:
"_source": {
"id": "engine oil",
"name": "engine oil"
}

"_source": {
"id": "engine heater",
"name": "engine heater"
}
Two documents with engine in the field 'id'

When I use the same phrase_suggester query am getting the results as shown:

"suggest": {
"did-you-mean": [
{
"text": "engune heter",
"offset": 0,
"length": 12,
"options": [
{
"text": "engune heater",
"score": 0.016957704
},
{
"text": "engine heter",
"score": 0.014474084
}
]
}
]
}

May I know the reason for this strange behaviour of phrase_suggester?????


(system) #2