Possible to dynamically define a custom filter of type mapping on a per field basis?

(Eric Daniels) #1

So I'm just trying to figure out if what I'm trying to do is even possible.

Basically, the second answer to this stackoverflow question (http://stackoverflow.com/questions/34624194/how-to-sort-ordinal-values-in-elasticsearch), is what I'm trying to do; I need to create a mapping so a discrete set of values for a field are sorted in a particular order. However, I need to create a different mapping dynamically for various fields as they are added to the index mapping. Doing this in Java, btw.

So while field 1 may use a mapping of [value1=>1, value2=>2, value3=>3], field 2 might be [valueA=>1, valueB=>2, valueC=>3,...], field 3 would be another completely different mapping of values, and so on. Without needing to create a custom analyzer and char filter for every single field, is it possible to use a single analyzer and dynamically define what that mapping will be when we add the field to the index definition? Essentially, we have a number of fields that are in essence enums (without actually being defined as a Java enum) that we want to sort in order of definition with the mapping being created from our 'enum' values, and I'm looking for a way to make that work.

If that approach isn't possible, is there some other way to make this work? Thanks for any help, and please ask for clarification if what I'm trying to explain is unclear.

(Mark Walkom) #2

No that is not possible.

(Eric Daniels) #3

Well, that's misfortunate but good to know; now I can stop banging my head in that direction.

You have any suggestions of alternate ways to accomplish what I'm trying to do by any chance?

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.