Dynamic Templates, Faceted Search, and path_match


(Greg Brown) #1

I've tried a dozen variations to get this to work, so clearly there is
something I don't understand.

I'm trying to dynamically create a field on an object with both an analyzed
version of the field and a non-analyzed one so that the faceted results can
return individual terms or the whole field.

eg. meta.byline : "Greg Brown" and meta_raw.byline : "Greg Brown"; Result
of the meta_raw.byline facet should be "Greg Brown" while meta.byline
should have two terms: "greg" and "brown"

Here's my latest attempt: https://gist.github.com/3640532

Maybe I'm not using the path_match on the dynamic template correctly? Also,
I feel like the '"index" : "not_analyzed"' on the meta_raw object mapping
should get inherited by sub-fields, but that doesn't seem to be what
happens.

Bonus points for a way to use the multi_field type mapping to make
meta.byline and meta.byline.raw work. I decided to just try and get the
simple solution to work first.

Thanks for the help.
-Greg

--


(Greg Brown) #2

Figured out my own problem. Defining the meta and meta_raw fields as
objects seemed to override the dynamic template. Not sure if this is
intended behavior.

Working version: https://gist.github.com/3643513

Still can't get the multi_field to work: https://gist.github.com/3643618

-Greg

On Wed, Sep 5, 2012 at 11:42 AM, Greg Brown gbrown5878@gmail.com wrote:

I've tried a dozen variations to get this to work, so clearly there is
something I don't understand.

I'm trying to dynamically create a field on an object with both an
analyzed version of the field and a non-analyzed one so that the faceted
results can return individual terms or the whole field.

eg. meta.byline : "Greg Brown" and meta_raw.byline : "Greg Brown"; Result
of the meta_raw.byline facet should be "Greg Brown" while meta.byline
should have two terms: "greg" and "brown"

Here's my latest attempt: https://gist.github.com/3640532

Maybe I'm not using the path_match on the dynamic template correctly?
Also, I feel like the '"index" : "not_analyzed"' on the meta_raw object
mapping should get inherited by sub-fields, but that doesn't seem to be
what happens.

Bonus points for a way to use the multi_field type mapping to make
meta.byline and meta.byline.raw work. I decided to just try and get the
simple solution to work first.

Thanks for the help.
-Greg

--

--


(amos.wood) #3

I haven't had any success using the "path_match" option either. Instead, I
use the "match" option which works fine which matches only on the field
name and not on the path. If that isn't strict enough, then I define each
object's mapping explicitly. To fix your dynamic_templates section for the
multi_field,

change

"path_match" : "meta."

to

"match" : "byline"

On Wednesday, September 5, 2012 3:00:55 PM UTC-5, Greg Brown wrote:

Figured out my own problem. Defining the meta and meta_raw fields as
objects seemed to override the dynamic template. Not sure if this is
intended behavior.

Working version: https://gist.github.com/3643513

Still can't get the multi_field to work: https://gist.github.com/3643618

-Greg

On Wed, Sep 5, 2012 at 11:42 AM, Greg Brown <gbrow...@gmail.com<javascript:>

wrote:

I've tried a dozen variations to get this to work, so clearly there is
something I don't understand.

I'm trying to dynamically create a field on an object with both an
analyzed version of the field and a non-analyzed one so that the faceted
results can return individual terms or the whole field.

eg. meta.byline : "Greg Brown" and meta_raw.byline : "Greg Brown"; Result
of the meta_raw.byline facet should be "Greg Brown" while meta.byline
should have two terms: "greg" and "brown"

Here's my latest attempt: https://gist.github.com/3640532

Maybe I'm not using the path_match on the dynamic template correctly?
Also, I feel like the '"index" : "not_analyzed"' on the meta_raw object
mapping should get inherited by sub-fields, but that doesn't seem to be
what happens.

Bonus points for a way to use the multi_field type mapping to make
meta.byline and meta.byline.raw work. I decided to just try and get the
simple solution to work first.

Thanks for the help.
-Greg

--

--


(system) #4