Dash in facet field


(Patrik Votoček) #1

Hi,

i have problem with facets. I have documents with user field. In
documents is user "vrtak-cz". I use this field as facet (field term).

ES split this user in facets to 1. "vrtak" 2. "cz"

example data
https://gist.github.com/9bd1e1bc4bf289a576cc


(David Pilato) #2

Define a mapping for this field.
I use a keyword analyzer for the same use case.

HTH
David :wink:
@dadoonet

Le 10 déc. 2011 à 06:05, Patrik Votoček patrik@votocek.cz a écrit :

Hi,

i have problem with facets. I have documents with user field. In
documents is user "vrtak-cz". I use this field as facet (field term).

ES split this user in facets to 1. "vrtak" 2. "cz"

example data
https://gist.github.com/9bd1e1bc4bf289a576cc


(Patrik Votoček) #3

I'm newbe in ES world.

So how do i setup differend mapping for this field? How to say use whole
string?


(Patrik Votoček) #4

I found it :slight_smile:

https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json

So is it possible set mapping after documents in index?


(David Pilato) #5

No. You have to define the mapping for a document type before you send the first doc.

Hth
David :wink:
@dadoonet

Le 11 déc. 2011 à 05:54, Patrik Votoček patrik@votocek.cz a écrit :

I found it :slight_smile:

https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json

So is it possible set mapping after documents in index?


(Shay Banon) #6

Another possibly simpler solution is just to mark the field in the mapping
with index set to not_analyzed (which is the same as using keyword
analyzed). Note, in the same, make sure the analyzer is set to that, not
just the index_analyzer. And as David pointed out, you will have to set the
mapping when you create the index, and then index the data.

On Sun, Dec 11, 2011 at 8:53 AM, David Pilato david@pilato.fr wrote:

No. You have to define the mapping for a document type before you send the
first doc.

Hth
David :wink:
@dadoonet

Le 11 déc. 2011 à 05:54, Patrik Votoček patrik@votocek.cz a écrit :

I found it :slight_smile:

https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json

So is it possible set mapping after documents in index?


(system) #7