Configuring filters for analysis and search


(Maurício Linhares) #1

Hello guys,

I've just jumped the wagon and I'm a bit lost on how to configure the
fields to my liking. Given that I have a product document that would
look like this:

{
name: "some name here",
description : "big description here"
category_id : 1,
price : 20.00
}

I'd like to analyse "name" and "description" with the common tokenizer
then apply the lowercase, stop words, ascii folding for accents and
edge ngram filters. When searching I'd like to apply the same filters,
excluding only the edge ngram. I can push the document o ES, but I
can't figure out a way to configure this index to behave as I have
just explained. My real goal is to write a new version of this
tutorial ( http://codeshooter.wordpress.com/2011/01/13/full-text-search-in-in-rails-with-sunspot-and-solr/
) using ES.

Ideas?

Maurício Linhares


(Karussell) #2

Do you mean the filter chain? something like this?

{
"index" : {
"analysis" : {
"analyzer" : {
"myanalyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "stop"]
}
}
}
}
}

you'll need to put it into the elasticsearch.json under esHOME/config

which can then be referenced either in mapping definitions

and take a look here:

http://www.elasticsearch.com/docs/elasticsearch/index_modules/analysis/

On 19 Jan., 13:14, Maurício Linhares mauricio.linha...@gmail.com
wrote:

Hello guys,

I've just jumped the wagon and I'm a bit lost on how to configure the
fields to my liking. Given that I have a product document that would
look like this:

{
name: "some name here",
description : "big description here"
category_id : 1,
price : 20.00

}

I'd like to analyse "name" and "description" with the common tokenizer
then apply the lowercase, stop words, ascii folding for accents and
edge ngram filters. When searching I'd like to apply the same filters,
excluding only the edge ngram. I can push the document o ES, but I
can't figure out a way to configure this index to behave as I have
just explained. My real goal is to write a new version of this
tutorial (http://codeshooter.wordpress.com/2011/01/13/full-text-search-in-in-ra...
) using ES.

Ideas?

Maurício Linhareshttp://about.me/mauricio.linhares


(system) #3