Hi All,
I have a schema which uses Keywords to store values an example of a document would be something like this:
We aggregate on a number of properties too such as make/model/colour/condition etc
{
"properties": {
"bodyStyle": {
"type": "keyword"
},
"colourBase": {
"type": "keyword"
},
"condition": {
"type": "keyword"
},
"fuel": {
"type": "keyword"
},
"make": {
"type": "keyword"
},
"mileage": {
"type": "integer"
},
"model": {
"type": "keyword"
},
"registration": {
"type": "keyword"
},
"transmission": {
"type": "keyword"
}
}
}
I'm looking to implement a free text query, which then will do partial search across a number of fields
So they query could be ?query=ford and it would search across make/model/registration/colour for example and return ford, however this currently would only work if the query was ?query=Ford as we store the value in the make field as Ford, not ford
- Is it possible for it to convert to lowercase for the purpose of query?
- Is it possible to do partial matches too, so search ?query=for would do (LIKE '%for%' - how i would do it in SQL)
Effectively tying to create a query something like this:
WHERE LOWER(make) LIKE '%query%'
OR LOWER(model) LIKE '%query%'
OR LOWER(registration) LIKE '%query%'
OR LOWER(colourBase) LIKE '%query%'