Search by multiple fields with different boost


(Eugene Strokin) #1

Hello,
I'm stack with simple problem, and I'm asking for a suggestion:
I have documents indexed which have number of fields, but I need to
make a simple term search by 3 of them. I need fieldA be the most
important field, and fieldB and fieldC less.
So I've mapped them with specific boost parameter:

"fieldA":{"type":"string"}
"fieldB":{"type":"string", "analyzer":"string_lowercase", boost:0.8},
"fieldC":{"type":"string", "analyzer":"string_lowercase", boost:0.5},

As you see, I have custom analyzer for fields B and C, which doesn't
tokenize the values during indexing. I need it like this for another
types of searches.
So, should I just create a copy of those fields without the custom
analyzer (and if so, does ES has something like Solr copyField?), or
there is some better way to do this?

Thank you,
Eugene S.


(Shay Banon) #2

You should use multi field mapping:
http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html.

On Tue, Dec 6, 2011 at 5:57 AM, Eugene Strokin eugene@strokin.info wrote:

Hello,
I'm stack with simple problem, and I'm asking for a suggestion:
I have documents indexed which have number of fields, but I need to
make a simple term search by 3 of them. I need fieldA be the most
important field, and fieldB and fieldC less.
So I've mapped them with specific boost parameter:

"fieldA":{"type":"string"}
"fieldB":{"type":"string", "analyzer":"string_lowercase", boost:0.8},
"fieldC":{"type":"string", "analyzer":"string_lowercase", boost:0.5},

As you see, I have custom analyzer for fields B and C, which doesn't
tokenize the values during indexing. I need it like this for another
types of searches.
So, should I just create a copy of those fields without the custom
analyzer (and if so, does ES has something like Solr copyField?), or
there is some better way to do this?

Thank you,
Eugene S.


(system) #3