We have a field company_name of type text. For the same field, we have additional .raw field - company_name.raw which is a keyword field.
For the following SQL query, search on company_name
{
"query": "SELECT \"company_name\" AS \"column3\",COUNT( \"cursor\" ) AS \"column2\"FROM \"jobspikr_v3_data\" AS \"440b2537c24d29841e7443fdcdf254\"WHERE ( ( (\"company_name\" LIKE '%info%'))) GROUP BY \"company_name\" ORDER BY \"column3\" ASC LIMIT 101",
"fetch_size": 10
}
Its being translated to the following DSL, where search is applied on .raw
field.
{
"size": 0,
"query": {
"wildcard": {
"company_name.raw": {
"wildcard": "*info*",
"boost": 1.0
}
}
},
"_source": false,
"stored_fields": "_none_",
"aggregations": {
"groupby": {
"composite": {
"size": 10,
"sources": [
{
"136613": {
"terms": {
"field": "company_name.raw",
"missing_bucket": true,
"order": "asc"
}
}
}
]
},
"aggregations": {
"136626": {
"filter": {
"exists": {
"field": "cursor",
"boost": 1.0
}
}
}
}
}
}
}
Is there a way to restrict the search on the company_name field(not .raw) field?