Carrying out queries through an specific analyzer


(Algoncalves) #1

Hi All,

I´m trying to search using my own analyzer which was configured into elasticsearch.yml. The index mapping is declared below and it is working quite well.

private String fileAsString = "{"
	+ "\"tweet\" : {"
	+ "    \"properties\" : {"
	+ "         \"user\" : { \"type\" : \"string\", \"index\" : \"analyzed\", \"store\" : \"yes\"},"
	+ "         \"message\" : { \"type\" : \"string\", \"index\" : \"analyzed\", \"store\" : \"yes\", \"analyzer\" : \"my_analyzer\", \"term_vector\" : \"with_positions_offsets\"}"
	+ "}}}";

However I did not find a way to carry out a query using JAVA API based on the new analyzer. Is there a way to do this?

Regards,

Alex


(Lukáš Vlček) #2

Hi,

if you search on a "message" field the "my_analyzer" is not used?

Also I can see that query builders has a method to set analyzer, for
example:
https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java#L152

Regards,
Lukas

On Thu, Jan 27, 2011 at 4:30 AM, Algoncalves <
alexandre.l.goncalves@gmail.com> wrote:

Hi All,

I´m trying to search using my own analyzer which was configured into
elasticsearch.yml. The index mapping is declared below and it is working
quite well.

   private String fileAsString = "{"
           + "\"tweet\" : {"
           + "    \"properties\" : {"
           + "         \"user\" : { \"type\" : \"string\", \"index\" :

"analyzed",
"store" : "yes"},"
+ " "message" : { "type" : "string", "index"
:
"analyzed", "store" : "yes", "analyzer" : "my_analyzer",
"term_vector" : "with_positions_offsets"}"
+ "}}}";

However I did not find a way to carry out a query using JAVA API based on
the new analyzer. Is there a way to do this?

Regards,

Alex

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Carrying-out-queries-through-an-specific-analyzer-tp2359690p2359690.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Algoncalves) #3

Lukas,

Thanks for your help. It´s worked quite well.

Regards,

Alex


(system) #4