Define analyzer in a percolator query_string

Hi,

I am trying to register a percolator query that would analyze an URI field
to check whether or not it contains a given expression, defining at the
same time the analyzer used :

curl -XPUT 'http://127.0.0.1:9200/_percolator/tester/test1' -d '{

"query":{

"simple_query_string":{

"fields":[

"uri_field"

],

"query":"test",

"analyzer":"simple"

}

}

}'

but it seems the analyzer used stays the default one, so that this doc is
not matched by the percolator query :

curl -XPOST 'http://127.0.0.1:9200/tester/test/_percolate' -d '{

"doc": {

"uri_field": "http://www.test.foo"

}

}'

Am I doing something wrong or is it just impossible ?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5c690590-628c-40dc-bac0-07a996b79e4b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Btw, I found a different way to achieve my primary goal using a different
percolate query :

curl -XPUT 'http://127.0.0.1:9200/_percolator/tester/test1' -d '{

"query":{

"query_string":{

"fields":[

"uri_field"

],

"query":"test"

}

}

}'

But it would be better if I could use simple query strings with analyzers
since they best fit my main goal.

Le mercredi 12 février 2014 15:10:16 UTC+1, Dunaeth a écrit :

Hi,

I am trying to register a percolator query that would analyze an URI field
to check whether or not it contains a given expression, defining at the
same time the analyzer used :

curl -XPUT 'http://127.0.0.1:9200/_percolator/tester/test1' -d '{

"query":{

"simple_query_string":{

"fields":[

"uri_field"

],

"query":"test",

"analyzer":"simple"

}

}

}'

but it seems the analyzer used stays the default one, so that this doc is
not matched by the percolator query :

curl -XPOST 'http://127.0.0.1:9200/tester/test/_percolate' -d '{

"doc": {

"uri_field": "http://www.test.foo"

}

}'

Am I doing something wrong or is it just impossible ?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a33bc94e-a164-4912-9e1f-3fd2907417b4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

To explain what's happening in your scenario, when you make this call:

curl -XPOST 'http://127.0.0.1:9200/tester/test/_percolate' -d '{
{

"doc": {

"uri_field": "http://www.test.foo"

}

}'

The value "http://www.test.foo" is indexed using the standard analyzer (or
whatever is defined in your mapping for the uri_field, if you have one). So
in the case of the standard analyzer, this is broken down to ("http",
"www.test.foo").

When you define this query:

curl -XPUT 'http://127.0.0.1:9200/_percolator/tester/test1' -d '{

"query":{

"simple_query_string":{

"fields":[

"uri_field"

],

"query":"test",

"analyzer":"simple"

}

}

}'

The search value "test" is analyzed using the simple analyzer, then it is
executed against the indexed value "http://www.test.foo" which was
analyzed using the standard analyzer. Note that the simple analyzer is not
applied to the indexed value "http://www.test.foo". It is only applied to
the query value "test". You cannot influence the index analyzer at query
time. You can only influence the search analyzer.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/98ba4603-c80a-4ef8-a9c3-866c7684468a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.