Hi, I have a requirement where I want to search for numbers within a string by both the numeric value (e.g. 3) and the string value (e.g. "three").
For example given the following index configuration
PUT number-test
{
"mappings": {
"properties": {
"text": {
"type": "text",
"analyzer": "standard"
}
}
}
}
PUT number-test/_doc/1
{
"text": "this is the number three"
}
PUT number-test/_doc/2
{
"text": "this is the number 3"
}
PUT number-test/_doc/3
{
"text": "this is the number 2"
}
PUT number-test/_doc/4
{
"text": "this is the number two"
}
Then the following search would return both documents 1 & 2.
POST number-test/_search
{
"query": {
"match": {
"text": "three"
}
}
}
I know I could probably achieve this via synonyms. But I was hoping there was an automated way to do it (maybe through an additional tokenizer etc) that wouldn't require me having to configure every possible number as a synonym.
Thanks