i have web app, where iam trying to move more and more queries from mysql to elasticsearch, even the ones which are not Full text search, to lower the system load.
there are one type of queries which i need to match exactly with uploader username.
lets say, usernames are
tom
tom.bom
tom_bom
tom-bom
when i search for tom
i dont want other username matches to show up.
how can i do that ?
right now i am doing it like this way
Array
(
[index] => datasets
[type] => content
[body] => Array
(
[sort] => Array
(
[upload_date] => Array
(
[order] => desc
)
)
[query] => Array
(
[bool] => Array
(
[must] => Array
(
[match] => Array
(
[uploader] => tom
)
)
)
)
[from] => 0
[size] => 30
)
)
i just want to make this future proof, i dont have those users right now.
Thanks for your time,
here is my current mapping
{
"mappings": {
"content": {
"properties": {
"title":{
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"tags": { "type": "text" },
"category": { "type": "keyword" },
"sub_category": { "type": "keyword" },
"size": { "type": "long" },
"uploaders": { "type": "integer" },
"downloaders": { "type": "integer" },
"upload_date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"uploader":{
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
}
}
}
}
}