Text_phrase_prefix not giving the required results, the syntax is exactly as explained at "http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html"


(narinder.izap) #1

text_phrase_prefix is not working for some special cases as:

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
* "query": "b",*
"analyzer": "default"
}
}
}
}

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "bel",
"analyzer": "default"
}
}
}
}

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "bl",
"analyzer": "default"
}
}
}
}

The above queries are giving the results but the following query is giving
no result.
{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "be",
"analyzer": "default"
}
}
}
}

In all the queries, the difference is the query keyword. I don't
understand how it is searching in the document.
and please do explain what is the exact functionality of max_expansions
parameter.


(Lukáš Vlček) #2

Hi,

do you happen to have recreation script? This would really help. I think
have seen something similar recently but I did not have a chance to
investigate further, so I am not sure if I hit the same issue or the problem
was on my side. So, please, if you have recreation script I would be really
interested in it.

As for the max_expansions this is the upper limit to as to how many terms
with the same prefix will be checked from the index. For example if your
last term in the prefix phrase query is "he" then ES will try to enumerate
all matching candidates from the index ("hello","hell","help",...) and
execute boolean query with all variations. But this can expand to very huge
candidate set of queries which can result in "Too Many Clauses" exception.
In this case you can easily setup the max_expansions to some value that
still gets your acceptable results but do not run into the exception.

Regards,
Lukas

On Wed, Oct 12, 2011 at 8:14 AM, Narinder Kaur narinder.kaur@izap.inwrote:

text_phrase_prefix is not working for some special cases as:

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
* "query": "b",*
"analyzer": "default"
}
}
}
}

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "bel",
"analyzer": "default"
}
}
}
}

{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "bl",
"analyzer": "default"
}
}
}
}

The above queries are giving the results but the following query is giving
no result.
{
"query": {
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "be",
"analyzer": "default"
}
}
}
}

In all the queries, the difference is the query keyword. I don't
understand how it is searching in the document.
and please do explain what is the exact functionality of max_expansions
parameter.


(system) #3