You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 7, 2025. It is now read-only.
The `match` query is in most cases a full-text search, e.g.:
```json
{
"query": {
"match": {
"message": "this is a test"
}
}
}
```
However, it can also be used to find an exact value against a integer
field:
```json
{
"query": {
"match": {
"products_count": "5"
}
}
}
```
In such case Quesma would generate an invalid SQL, trying to do an
`ILIKE` against an `Int64` column:
```
Illegal type Int64 of argument of function ilike
```
Fix the issue by introducing an internal __quesma_match operator and a
transformation which transforms it either to `ILIKE` or `=`.
Fixes#1018
---------
Co-authored-by: Krzysztof Kiewicz <[email protected]>
[]string{`SELECT "message" FROM `+TableName+` WHERE "host_name" iLIKE '%prometheus%' LIMIT 10`},
1137
1137
[]string{},
@@ -1148,7 +1148,7 @@ var TestsSearch = []SearchTestCase{
1148
1148
"size": 100,
1149
1149
"track_total_hits": false
1150
1150
}`,
1151
-
[]string{`((("message" iLIKE '%this%' OR "message" iLIKE '%is%') OR "message" iLIKE '%a%') OR "message" iLIKE '%test%')`},
1151
+
[]string{`(((("message" __quesma_match 'this') OR ("message" __quesma_match 'is')) OR ("message" __quesma_match 'a')) OR ("message" __quesma_match 'test'))`},
1152
1152
model.ListAllFields,
1153
1153
[]string{
1154
1154
`SELECT "message" FROM `+TableName+` WHERE ((("message" iLIKE '%this%' OR "message" iLIKE '%is%') `+
@@ -1405,7 +1405,7 @@ var TestsSearch = []SearchTestCase{
1405
1405
},
1406
1406
"track_total_hits": false
1407
1407
}`,
1408
-
[]string{`"message" iLIKE '%this is a test%'`},
1408
+
[]string{`("message" __quesma_match 'this is a test')`},
1409
1409
model.ListAllFields,
1410
1410
[]string{`SELECT "message" FROM `+TableName+` WHERE "message" iLIKE '%this is a test%'`},
1411
1411
[]string{},
@@ -1423,7 +1423,7 @@ var TestsSearch = []SearchTestCase{
1423
1423
},
1424
1424
"track_total_hits": false
1425
1425
}`,
1426
-
[]string{`"message" iLIKE '%this is a test%'`},
1426
+
[]string{`("message" __quesma_match 'this is a test')`},
1427
1427
model.ListAllFields,
1428
1428
[]string{`SELECT "message" FROM `+TableName+` WHERE "message" iLIKE '%this is a test%'`},
1429
1429
[]string{},
@@ -1687,9 +1687,9 @@ var TestsSearch = []SearchTestCase{
1687
1687
"track_total_hits": true
1688
1688
}`,
1689
1689
[]string{
1690
-
`(("message" iLIKE '%User logged out%' AND "host.name" iLIKE '%poseidon%') `+
1690
+
`((("message" __quesma_match 'User logged out') AND ("host.name" __quesma_match 'poseidon')) `+
1691
1691
`AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491)))`,
1692
-
`((("message" iLIKE '%User logged out%' AND "host.name" iLIKE '%poseidon%') `+
1692
+
`(((("message" __quesma_match 'User logged out') AND ("host.name" __quesma_match 'poseidon')) `+
1693
1693
`AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491))) `+
1694
1694
`AND "stream.namespace" IS NOT NULL)`,
1695
1695
},
@@ -1847,10 +1847,10 @@ var TestsSearch = []SearchTestCase{
1847
1847
"timeout": "1000ms"
1848
1848
}`,
1849
1849
[]string{
1850
-
`((("message" iLIKE '%User logged out%' AND "host.name" iLIKE '%poseidon%') `+
1850
+
`(((("message" __quesma_match 'User logged out') AND ("host.name" __quesma_match 'poseidon')) `+
1851
1851
`AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491))) `+
1852
1852
`AND "namespace" IS NOT NULL)`,
1853
-
`(("message" iLIKE '%User logged out%' AND "host.name" iLIKE '%poseidon%') `+
1853
+
`((("message" __quesma_match 'User logged out') AND ("host.name" __quesma_match 'poseidon')) `+
1854
1854
`AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491)))`,
1855
1855
},
1856
1856
model.Normal,
@@ -2085,7 +2085,7 @@ var TestsSearch = []SearchTestCase{
0 commit comments