Multilanguage Support and Empty Aggregation Buckets in Search UI

Hi everyone,

I'm working on an Elasticsearch mapping for a product catalog, and I need help with two key issues:

1. Adding Multilanguage Support

  • Some fields (like nombre and descor_scrap) already use a nested structure with lang and value, but not all fields support multiple languages.
  • The attributes field also has a lang property, and I want to ensure efficient multilingual indexing and searching.
  • What's the best approach to handle multilanguage support across all relevant fields?

2. Empty Aggregation Buckets in Search UI

  • I have attributes as a nested field, and I need to perform dynamic aggregations on it.
  • Running this aggregation directly in Elasticsearch's Dev Console works fine but not in Search UI:
GET products_v2/_search
{
  "size": 0,
  "aggs": {
    "attributes_nested": {
      "nested": {
        "path": "attributes"
      },
      "aggs": {
        "by_key": {
          "terms": {
            "field": "attributes.key",
            "size": 10
          },
          "aggs": {
            "by_value": {
              "terms": {
                "field": "attributes.value",
                "size": 10
              }
            }
          }
        }
      }
    }
  }
}

Any insights would be greatly appreciated! :rocket:

Here is the current mapping:

{
  "products_v2" : {
    "mappings" : {
      "properties" : {
        "activo" : {
          "type" : "integer"
        },
        "attributes" : {
          "type" : "nested",
          "properties" : {
            "attribute_type" : {
              "type" : "keyword"
            },
            "key" : {
              "type" : "keyword"
            },
            "lang" : {
              "type" : "keyword"
            },
            "value" : {
              "type" : "keyword"
            }
          }
        },
        "categoria_horizontal" : {
          "type" : "integer"
        },
        "categorias_verticales" : {
          "type" : "integer"
        },
        "codigo_fabricante" : {
          "type" : "keyword"
        },
        "descor_scrap" : {
          "type" : "nested",
          "properties" : {
            "lang" : {
              "type" : "keyword"
            },
            "value" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword"
                }
              }
            }
          }
        },
        "id_product" : {
          "type" : "integer"
        },
        "nombre" : {
          "type" : "nested",
          "properties" : {
            "lang" : {
              "type" : "keyword"
            },
            "value" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword"
                }
              }
            }
          }
        },
        "price" : {
          "type" : "float"
        },
        "referencia" : {
          "type" : "keyword"
        },
        "suggest" : {
          "type" : "completion",
          "analyzer" : "simple",
          "preserve_separators" : true,
          "preserve_position_increments" : true,
          "max_input_length" : 50
        }
      }
    }
  }