If your intention is to have a documenst that looks like these
POST discuss/_doc
{
"lox": "1656282032356",
"details": {
"en": "Long Sleeve Cotton",
"fr": "Coton à manches longues"
},
"label": {
"en": "Large Red Shirt",
"fr": "Grande chemise rouge"
}
}
# Or
POST discuss/_doc
{
"lox": "1656282032356",
"details": {
"en": "Long Sleeve Cotton"
},
"label": {
"en": "Large Red Shirt"
}
}
# Or
POST discuss/_doc
{
"lox": "1656282032356",
"details": {
"fr": "Coton à manches longues"
},
"label": {
"fr": "Grande chemise rouge"
}
}
Then your mapping would look like
PUT discuss/
{
"mappings": {
"properties": {
"lox": {
"type": "keyword",
"store": true
},
"label": {
"properties": {
"en": {
"type": "text",
"analyzer": "english"
},
"fr": {
"type": "text",
"analyzer": "french"
},
"de": {
"type": "text",
"analyzer": "german"
}
}
},
"details": {
"properties": {
"en": {
"type": "text",
"analyzer": "english",
"store": true
},
"fr": {
"type": "text",
"analyzer": "french",
"store": true
},
"de": {
"type": "text",
"analyzer": "german",
"store": true
}
}
}
}
}
}
If you want a single fields with the same value that is analyzed several ways then it would look like this.. but I am not sure that make sense. In this case english would be the default.
PUT discuss/
{
"mappings": {
"properties": {
"lox": {
"type": "keyword",
"store": true
},
"label": {
"type": "text",
"analyzer": "english",
"fields": {
"fr": {
"type": "text",
"analyzer": "french"
},
"de": {
"type": "text",
"analyzer": "german"
}
}
},
"details": {
"type": "text",
"analyzer": "english",
"store": true,
"fields": {
"fr": {
"type": "text",
"analyzer": "french",
"store": true
},
"de": {
"type": "text",
"analyzer": "german",
"store": true
}
}
}
}
}
}
Then you are just analyzing the same text 3 different ways... maybe that is what you want.
POST discuss/_doc
{
"lox": "1656282032356",
"details": "Long Sleeve Cotton",
"label": "Large Red Shirt"
}
GET /discuss/_search
{
"fields": [
"*"
]
}
# Result
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "discuss",
"_id" : "NEw1o4EBUD-rWNEOQAdl",
"_score" : 1.0,
"_source" : {
"lox" : "1656282032356",
"details" : "Long Sleeve Cotton",
"label" : "Large Red Shirt"
},
"fields" : {
"details.fr" : [
"Long Sleeve Cotton"
],
"label.fr" : [
"Large Red Shirt"
],
"lox" : [
"1656282032356"
],
"details.de" : [
"Long Sleeve Cotton"
],
"details" : [
"Long Sleeve Cotton"
],
"label" : [
"Large Red Shirt"
],
"label.de" : [
"Large Red Shirt"
]
}
}
]
}
}