# Best practice for showing different text on a terms facet

(Raul, Jr. Martinez) #1

Hello,

Just wondering how the following requirements can be accomplished
using ElasticSearch (if there's such an option).

I have several sets of documents that contains the following fields:

doc 1:
author --> John Doe
content --> This is a test message

doc 2:
author --> John Doe Jr.
content --> This is a test message from junior

I want to be able to display a navigation based on terms facet like

John Doe (1)
John Doe Jr (1)

The "John Doe (1)" link is based on the following sample html anchor

The "John Doe Jr (1)" link is based on the following sample html
anchor

Can this be done using a single term facet query?

(Wojciech Durczyński) #2

It wonders me too.
I have one field with document's internal name and second with
"caption" - translation to show.
I'd like to do filtering on internal name but show facet values taken
from caption field.
It'd be great to have terms facet, that returns aggregated data from
these two fields (facet values as pairs of internal name and caption).

On Jul 9, 4:44 pm, rmartinez jun...@gmail.com wrote:

Hello,

Just wondering how the following requirements can be accomplished
using ElasticSearch (if there's such an option).

I have several sets of documents that contains the following fields:

doc 1:
author --> John Doe
content --> This is a test message

doc 2:
author --> John Doe Jr.
content --> This is a test message from junior

I want to be able to display a navigation based on terms facet like

John Doe (1)
John Doe Jr (1)

The "John Doe (1)" link is based on the following sample html anchor

The "John Doe Jr (1)" link is based on the following sample html
anchor

Can this be done using a single term facet query?

(Shay Banon) #3

In this case, why not do a simple search on the author name and get back the doc itself, without using terms facet? The text phrase prefix query might fit here.

On Monday, July 11, 2011 at 11:34 AM, Wojciech Durczyński wrote:

It wonders me too.
I have one field with document's internal name and second with
"caption" - translation to show.
I'd like to do filtering on internal name but show facet values taken
from caption field.
It'd be great to have terms facet, that returns aggregated data from
these two fields (facet values as pairs of internal name and caption).

On Jul 9, 4:44 pm, rmartinez <jun...@gmail.com (http://gmail.com)> wrote:

Hello,

Just wondering how the following requirements can be accomplished
using ElasticSearch (if there's such an option).

I have several sets of documents that contains the following fields:

doc 1:
author --> John Doe
content --> This is a test message

doc 2:
author --> John Doe Jr.
content --> This is a test message from junior

I want to be able to display a navigation based on terms facet like