0

Similar question was raised on discuss.elastic.co.

Given I have some documents in my elasticsearch index with a tag field.

{
...
tag:[
    {
      "id":"1",
      "label":{
        "en":"dog",
        "ger":"Hund"
    },
    {
      "id":"2",
      "label":{
        "en":"cat",
        "de":"Katze"
      }
    }
]
...
}

I´d like to build a frontend with elastic/search-ui and provide a facet for the tag field so that the actual filtering is applied on basis of the id subfield.

Within the framework this can be achieved by providing a simple configuration within the configuration object.

let searchConfig: SearchDriverOptions = {
  ...
  searchQuery:{
    ...
    facets:{
      "tag.id":{type:"value",size:"5"}
    }
  }
}

While this works like expected it is only half of the solution.

What I want to achieve in a next step is to display the content of tag.label.en within the ui instead of the values of tag.id.

In the end the filtering should be done on basis of tag.id but in the UI the corresponding value of tag.label.en should be shown.

Is there a simple way to achieve this in elastic/search-ui?

jschnasse
  • 8,526
  • 6
  • 32
  • 72

0 Answers0