Query search with "completion" field does not find results


(Tihomir Lichev) #1

Hi
I have the index and mapping structure, described in the attached file
I'm using the Java API to make queries:

QueryBuilder termQuery = QueryBuilders.queryString("The Search Phrase")
.field("keywords", 1.3f)
.field("title", 2f)
.field("description", 1.0f)
.field("full_text", 1.0f)
.defaultOperator(Operator.AND);

Which generates the following query JSON:
{
"query" : {
"query_string" : {
"query" : "The Search Phrase",
"fields" : [ "keywords^1.3", "title^2.0", "description^1.0",
"full_text^1.0" ],
"default_operator" : "and"
}
}
}

Running this results no documents found.

If I remove "full_text" from the fields list ( "fields" : [
"keywords^1.3", "title^2.0", "description^1.0" ] ) it finds for example 20
documents

The "full_text" is of type "completion" as you can see from the
attachment, and it contains the search phrase.
If it is included in the fields list no documents are found.

Am I doing something wrong ?

Best regards
Tihomir

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

completion fields are stored differently and are only intended to be used
in suggest queries. You could maybe use a multifield, see
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-multi-field-type.html

--Alex

On Fri, Nov 22, 2013 at 4:41 PM, Tihomir Lichev shoteff@gmail.com wrote:

Hi
I have the index and mapping structure, described in the attached file
I'm using the Java API to make queries:

QueryBuilder termQuery = QueryBuilders.queryString("The Search Phrase")
.field("keywords", 1.3f)
.field("title", 2f)
.field("description", 1.0f)
.field("full_text", 1.0f)
.defaultOperator(Operator.AND);

Which generates the following query JSON:
{
"query" : {
"query_string" : {
"query" : "The Search Phrase",
"fields" : [ "keywords^1.3", "title^2.0", "description^1.0",
"full_text^1.0" ],
"default_operator" : "and"
}
}
}

Running this results no documents found.

If I remove "full_text" from the fields list ( "fields" : [
"keywords^1.3", "title^2.0", "description^1.0" ] ) it finds for example
20 documents

The "full_text" is of type "completion" as you can see from the
attachment, and it contains the search phrase.
If it is included in the fields list no documents are found.

Am I doing something wrong ?

Best regards
Tihomir

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Tihomir Lichev) #3

I can't understand why the inclusion of such field breaks the result
На 23.11.2013 08:01 "Alexander Reelsen" alr@spinscale.de написа:

Hey,

completion fields are stored differently and are only intended to be used
in suggest queries. You could maybe use a multifield, see
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-multi-field-type.html

--Alex

On Fri, Nov 22, 2013 at 4:41 PM, Tihomir Lichev shoteff@gmail.com wrote:

Hi
I have the index and mapping structure, described in the attached file
I'm using the Java API to make queries:

QueryBuilder termQuery = QueryBuilders.queryString("The Search Phrase")
.field("keywords", 1.3f)
.field("title", 2f)
.field("description", 1.0f)
.field("full_text", 1.0f)
.defaultOperator(Operator.AND);

Which generates the following query JSON:
{
"query" : {
"query_string" : {
"query" : "The Search Phrase",
"fields" : [ "keywords^1.3", "title^2.0", "description^1.0",
"full_text^1.0" ],
"default_operator" : "and"
}
}
}

Running this results no documents found.

If I remove "full_text" from the fields list ( "fields" : [
"keywords^1.3", "title^2.0", "description^1.0" ] ) it finds for example
20 documents

The "full_text" is of type "completion" as you can see from the
attachment, and it contains the search phrase.
If it is included in the fields list no documents are found.

Am I doing something wrong ?

Best regards
Tihomir

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/oolo6IathEw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4