Multi valued field with variable index time "analyzed" setting - how to do this using elastic search?


(kai lilleby) #1

Trying to migrate from using Lucene directly to using Elastic Search,
ive stumbled upon the following challenge:

My Lucene code:
document = new Document() ...
document.add(new Field("fieldname", valueMustNOTBeAnalyzed,
Field.Store.YES, Field.Index.NOT_ANALYZED));
document.add(new Field("fieldname, valueMustBeAnalyzed,
Field.Store.YES, Field.Index.ANALYZED));
... add document to index...

How do i handle this using Elastic Search?
Any ideas?


(Shay Banon) #2

In the mapping of a specific field, you can specify that its not_analyzed
under its "index" option. See more there:
http://www.elasticsearch.org/guide/reference/mapping/core-types.html.

On Thu, Jan 12, 2012 at 10:23 AM, Kai Lilleby kai@systemfabrikken.nowrote:

Trying to migrate from using Lucene directly to using Elastic Search,
ive stumbled upon the following challenge:

My Lucene code:
document = new Document() ...
document.add(new Field("fieldname", valueMustNOTBeAnalyzed,
Field.Store.YES, Field.Index.NOT_ANALYZED));
document.add(new Field("fieldname, valueMustBeAnalyzed,
Field.Store.YES, Field.Index.ANALYZED));
... add document to index...

How do i handle this using Elastic Search?
Any ideas?


(kai lilleby) #3

Tanks for quick reply!
To be more presise - im looking for the ability to specify wether to
analyze the field at index request time - not at setup/mapping
definition time - as one can when adding Field to a lucene Document.

My second question is: how does ES support multi valued fields - ie in
lucene: adding several Field instances to one and the same Document
using the same field name but different settings , eg. adding product
number as not-analyzed but product description analyzed - using the
same field name

Kai:)

On Jan 12, 11:52 am, Shay Banon kim...@gmail.com wrote:

In the mapping of a specific field, you can specify that its not_analyzed
under its "index" option. See more there:http://www.elasticsearch.org/guide/reference/mapping/core-types.html.

On Thu, Jan 12, 2012 at 10:23 AM, Kai Lilleby k...@systemfabrikken.nowrote:

Trying to migrate from using Lucene directly to using Elastic Search,
ive stumbled upon the following challenge:

My Lucene code:
document = new Document() ...
document.add(new Field("fieldname", valueMustNOTBeAnalyzed,
Field.Store.YES, Field.Index.NOT_ANALYZED));
document.add(new Field("fieldname, valueMustBeAnalyzed,
Field.Store.YES, Field.Index.ANALYZED));
... add document to index...

How do i handle this using Elastic Search?
Any ideas?


(vinhphu1711) #4

Hi Kia,
Do you mean this one http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html ?
On Jan 13, 2012, at 12:42 AM, Kai Lilleby wrote:

Tanks for quick reply!
To be more presise - im looking for the ability to specify wether to
analyze the field at index request time - not at setup/mapping
definition time - as one can when adding Field to a lucene Document.

My second question is: how does ES support multi valued fields - ie in
lucene: adding several Field instances to one and the same Document
using the same field name but different settings , eg. adding product
number as not-analyzed but product description analyzed - using the
same field name

Kai:)

On Jan 12, 11:52 am, Shay Banon kim...@gmail.com wrote:

In the mapping of a specific field, you can specify that its not_analyzed
under its "index" option. See more there:http://www.elasticsearch.org/guide/reference/mapping/core-types.html.

On Thu, Jan 12, 2012 at 10:23 AM, Kai Lilleby k...@systemfabrikken.nowrote:

Trying to migrate from using Lucene directly to using Elastic Search,
ive stumbled upon the following challenge:

My Lucene code:
document = new Document() ...
document.add(new Field("fieldname", valueMustNOTBeAnalyzed,
Field.Store.YES, Field.Index.NOT_ANALYZED));
document.add(new Field("fieldname, valueMustBeAnalyzed,
Field.Store.YES, Field.Index.ANALYZED));
... add document to index...

How do i handle this using Elastic Search?
Any ideas?


(Shay Banon) #5

It makes little sense to add under the same field name in Lucene fields with different analysis settings. But, as was noted, the multi field type can be used to have the same json data be indexed differently under different field names.

On Monday, February 6, 2012 at 3:45 AM, Phu Le wrote:

Hi Kia,
Do you mean this one http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html ?
On Jan 13, 2012, at 12:42 AM, Kai Lilleby wrote:

Tanks for quick reply!
To be more presise - im looking for the ability to specify wether to
analyze the field at index request time - not at setup/mapping
definition time - as one can when adding Field to a lucene Document.

My second question is: how does ES support multi valued fields - ie in
lucene: adding several Field instances to one and the same Document
using the same field name but different settings , eg. adding product
number as not-analyzed but product description analyzed - using the
same field name

Kai:)

On Jan 12, 11:52 am, Shay Banon <kim...@gmail.com (http://gmail.com)> wrote:

In the mapping of a specific field, you can specify that its not_analyzed
under its "index" option. See more there:http://www.elasticsearch.org/guide/reference/mapping/core-types.html.

On Thu, Jan 12, 2012 at 10:23 AM, Kai Lilleby k...@systemfabrikken.nowrote:

Trying to migrate from using Lucene directly to using Elastic Search,
ive stumbled upon the following challenge:

My Lucene code:
document = new Document() ...
document.add(new Field("fieldname", valueMustNOTBeAnalyzed,
Field.Store.YES, Field.Index.NOT_ANALYZED));
document.add(new Field("fieldname, valueMustBeAnalyzed,
Field.Store.YES, Field.Index.ANALYZED));
... add document to index...

How do i handle this using Elastic Search?
Any ideas?


(system) #6