Stop words and query_string

Dear all,

as this is my first post, I want to thanks all elasticsearch contributors
for this very nice tool.

However, I do not understand which analyzer is it used during the query.

The stop words seems not removed from the query for "_al" or for a list of
specified fields. Here is my test queries:

#!/bin/bash

#create index with specific stop words
curl -XPOST -d '{
"index": {
"number_of_shards" : 3,
"analysis": {
"analyzer": {
"english" : {
"type":"english",
"stopwords" : ["the", "stop1"]
}
}
}
}
}' http://localhost:9200/qstring
echo

#apply analyzer
curl -XPUT -d '{
"doc" : {
"properties" : {
"text" : {
"type" : "string",
"analyzer" : "english"
}
}
}
}' http://localhost:9200/qstring/doc/_mapping
echo

#sample data
curl -XPOST -d '{
"text" : "This is a test sentence containig stop words."
}' http://localhost:9200/qstring/doc?pretty=true
echo

#refresh for direct query
curl -XPOST http://localhost:9200/qstring/_refresh
echo

#this query match as expected
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_field": "text",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/_search?pretty=true
echo

#this does not match but why? Is it a bug?
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/_search?pretty=true
echo

Do I miss something?

Many thanks in advance,

Regards,

-- Johnny

--
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.

Hello,

nobody really?

Regards,

-- Johnny

On Wednesday, April 17, 2013 11:04:04 AM UTC+2, Johnny Mariéthoz wrote:

Dear all,

as this is my first post, I want to thanks all elasticsearch contributors
for this very nice tool.

However, I do not understand which analyzer is it used during the query.

The stop words seems not removed from the query for "_al" or for a list of
specified fields. Here is my test queries:

#!/bin/bash

#create index with specific stop words
curl -XPOST -d '{
"index": {
"number_of_shards" : 3,
"analysis": {
"analyzer": {
"english" : {
"type":"english",
"stopwords" : ["the", "stop1"]
}
}
}
}
}' http://localhost:9200/qstring
echo

#apply analyzer
curl -XPUT -d '{
"doc" : {
"properties" : {
"text" : {
"type" : "string",
"analyzer" : "english"
}
}
}
}' http://localhost:9200/qstring/doc/_mapping
echo

#sample data
curl -XPOST -d '{
"text" : "This is a test sentence containig stop words."
}' http://localhost:9200/qstring/doc?pretty=true
echo

#refresh for direct query
curl -XPOST http://localhost:9200/qstring/_refresh
echo

#this query match as expected
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_field": "text",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/_search?pretty=true
echo

#this does not match but why? Is it a bug?
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/_search?pretty=true
echo

Do I miss something?

Many thanks in advance,

Regards,

-- Johnny

--
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.

Hey,

you need to set the analyzer for the _all field as well.

--Alex

On Mon, Apr 22, 2013 at 7:47 AM, Johnny Mariéthoz chezjohnny@gmail.comwrote:

Hello,

nobody really?

Regards,

-- Johnny

On Wednesday, April 17, 2013 11:04:04 AM UTC+2, Johnny Mariéthoz wrote:

Dear all,

as this is my first post, I want to thanks all elasticsearch contributors
for this very nice tool.

However, I do not understand which analyzer is it used during the query.

The stop words seems not removed from the query for "_al" or for a list
of specified fields. Here is my test queries:

#!/bin/bash

#create index with specific stop words
curl -XPOST -d '{
"index": {
"number_of_shards" : 3,
"analysis": {
"analyzer": {
"english" : {
"type":"english",
"stopwords" : ["the", "stop1"]
}
}
}
}
}' http://localhost:9200/qstring
echo

#apply analyzer
curl -XPUT -d '{
"doc" : {
"properties" : {
"text" : {
"type" : "string",
"analyzer" : "english"
}
}
}
}' http://localhost:9200/qstring/**doc/_mappinghttp://localhost:9200/qstring/doc/_mapping
echo

#sample data
curl -XPOST -d '{
"text" : "This is a test sentence containig stop words."
}' http://localhost:9200/qstring/**doc?pretty=truehttp://localhost:9200/qstring/doc?pretty=true
echo

#refresh for direct query
curl -XPOST http://localhost:9200/qstring/**_refreshhttp://localhost:9200/qstring/_refresh
echo

#this query match as expected
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_field": "text",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/**_search?pretty=truehttp://localhost:9200/qstring/_search?pretty=true
echo

#this does not match but why? Is it a bug?
curl -d '{
"query" : {
"query_string" : {
"query" : "stop1 test",
"default_operator": "AND"
}
}
}' http://localhost:9200/qstring/**_search?pretty=truehttp://localhost:9200/qstring/_search?pretty=true
echo

Do I miss something?

Many thanks in advance,

Regards,

-- Johnny

--
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.

Hello Alex,

Thanks for your answer.

I agree that it will work on this specific case, but in my final
application, I will use more than one term (english, french, but also
keywords, title, etc.). In such case, I want that for a "_all" query the
corresponding analyzer would be used for each term, such as
(english_analyzer for english term, title_analyzer for title and so on). As
I understood, "analyzer" property is an alias for index_analyzer and
search_analyzer.

I hopped that querying _all will use the correct analyzer for each term.
Your proposition is equivalent to set a analyzer for the query, but I do
not want to have only one analyzer for all the terms.

Regards,

On Monday, April 22, 2013 9:11:06 AM UTC+2, Alexander Reelsen wrote:

Hey,

you need to set the analyzer for the _all field as well.

--Alex

--
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.