I am new to Elasticsearch.
I have the following mapping:
{
"mappings": {
"book": {
"properties": {
"title": {
"properties": {
"en": {
"type": "string",
"analyzer": "standard"
},
"ar": {
"type": "string",
"analyzer": "standard"
}
}
},
"keyword": {
"properties": {
"en": {
"type": "string",
"analyzer": "standard"
},
"ar": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
}
}
A sample document may have two languages for the same field of the same book. Here are two example documents:
{
"title" : {
"en": "hello",
"ar": "مرحبا"
},
"keyword" : {
"en": "world",
"ar": "عالم"
}
}
{
"title" : {
"en": "Elasticsearch"
},
"keyword" : {
"en": "full-text index"
}
}
Now I want to do a search against the _all field. Here is my query:
"query": {
"match" : {
"_all" : {
"query" : "hello",
"operator" : "OR"
}
}
}
Is this correct mapping? One of the reasons that I want to use _all field instead of listing the specific fields in query is that I will include more languages.
The thing I am not sure about is how to add boost to the title.en, title.ar fields in the above query? Any better way of doing so in case of more languages?
Thanks and regards.