How can I change indexed expression for a field?

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

I don't know if you can do that using scripts.
If not, you can build your own plugin mapper.

I wrote a sample project here: https://github.com/dadoonet/elasticsearch-mapper-demo

It takes a field from source and UPPERCASE it in another field during index phase.
Instead of uppercase, you can do what you want...

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 déc. 2012 à 23:57, Burak Emre Kabakcı emrekabakci@gmail.com a écrit :

Can I manually change the indexed term for a field? For example, the expression is "this is a test". The _source field will keep the actual expression "this is a test" but it will be indexed as "this is a test or example" so I elasticsearch will return this document when I query "example".

--

Hey there,

the synonym filter provides a similar functionality you might be searching
for... if you provide a more exact use-case, perhaps someone has a more
exact idea
http://www.elasticsearch.org/guide/reference/index-modules/analysis/synonym-tokenfilter.html

--Alex

On Sat, Dec 29, 2012 at 11:57 PM, Burak Emre Kabakcı
emrekabakci@gmail.comwrote:

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

--

Synonym may not work for me. I have an index called artist and some of
these artists have nickname or acronym. (Actually I use Musicbrainz and
there is more explanation here:
http://musicbrainz.org/doc/Style/Artist/Aliases) I don't want to store
these nicknames or acronyms etc. but it I want to index "name" field with
all of them.

On Sunday, December 30, 2012 3:22:55 PM UTC+2, Alexander Reelsen wrote:

Hey there,

the synonym filter provides a similar functionality you might be searching
for... if you provide a more exact use-case, perhaps someone has a more
exact idea

http://www.elasticsearch.org/guide/reference/index-modules/analysis/synonym-tokenfilter.html

--Alex

On Sat, Dec 29, 2012 at 11:57 PM, Burak Emre Kabakcı <emrek...@gmail.com<javascript:>

wrote:

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

--

It seems great but I must be able to get extra expressions for the field. I
can pass a json string as a value for "name" field and decode it in mapper
plugin but then I also have to edit the stored field value in _source
field. An another option I can think of is to add extra fields
called nickname and acronym that are neither indexed nor stored in _source
field. If I can get these values in mapper plugin I can manually append the
value of nickname and acronym to "name" field and analyze it with standard
analyzer. However I'm not sure I get the value of a field that are neither
indexed nor stored in _source field in mapper plugin.

On Sunday, December 30, 2012 5:00:17 AM UTC+2, David Pilato wrote:

I don't know if you can do that using scripts.
If not, you can build your own plugin mapper.

I wrote a sample project here:
https://github.com/dadoonet/elasticsearch-mapper-demo

It takes a field from source and UPPERCASE it in another field during
index phase.
Instead of uppercase, you can do what you want...

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 déc. 2012 à 23:57, Burak Emre Kabakcı <emrek...@gmail.com<javascript:>>
a écrit :

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

--

Hey,

ok synonyms doesnt make any sense for your usecase. What about the _all
field, which may contain the artist name as well as the aliases (see
include_in_all) and can be used for searching as well?

--Alex

On Sun, Dec 30, 2012 at 4:04 PM, Burak Emre Kabakcı
emrekabakci@gmail.comwrote:

Synonym may not work for me. I have an index called artist and some of
these artists have nickname or acronym. (Actually I use Musicbrainz and
there is more explanation here:
http://musicbrainz.org/doc/Style/Artist/Aliases) I don't want to store
these nicknames or acronyms etc. but it I want to index "name" field with
all of them.

On Sunday, December 30, 2012 3:22:55 PM UTC+2, Alexander Reelsen wrote:

Hey there,

the synonym filter provides a similar functionality you might be
searching for... if you provide a more exact use-case, perhaps someone has
a more exact idea
http://www.elasticsearch.org/guide/reference/index-modules/
analysis/synonym-tokenfilter.**htmlhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/synonym-tokenfilter.html

--Alex

On Sat, Dec 29, 2012 at 11:57 PM, Burak Emre Kabakcı emrek...@gmail.comwrote:

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

--

--

Actually I disabled _all field to decrease memory usage. I thought
that "include_in_all": true may not work with "index": "no" but it seems
ok. Now I set name field and all related fields "include_in_all":
true, "index": "no" and I'm able to search correctly with _all field.
Thanks!

On Monday, December 31, 2012 7:02:02 PM UTC+2, Alexander Reelsen wrote:

Hey,

ok synonyms doesnt make any sense for your usecase. What about the _all
field, which may contain the artist name as well as the aliases (see
include_in_all) and can be used for searching as well?

--Alex

On Sun, Dec 30, 2012 at 4:04 PM, Burak Emre Kabakcı <emrek...@gmail.com<javascript:>

wrote:

Synonym may not work for me. I have an index called artist and some of
these artists have nickname or acronym. (Actually I use Musicbrainz and
there is more explanation here:
http://musicbrainz.org/doc/Style/Artist/Aliases) I don't want to store
these nicknames or acronyms etc. but it I want to index "name" field with
all of them.

On Sunday, December 30, 2012 3:22:55 PM UTC+2, Alexander Reelsen wrote:

Hey there,

the synonym filter provides a similar functionality you might be
searching for... if you provide a more exact use-case, perhaps someone has
a more exact idea
http://www.elasticsearch.org/guide/reference/index-modules/
analysis/synonym-tokenfilter.**htmlhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/synonym-tokenfilter.html

--Alex

On Sat, Dec 29, 2012 at 11:57 PM, Burak Emre Kabakcı <emrek...@gmail.com

wrote:

Can I manually change the indexed term for a field? For example, the
expression is "this is a test". The _source field will keep the actual
expression "this is a test" but it will be indexed as "this is a test or
example" so I elasticsearch will return this document when I query
"example".

--

--

--