I run below query through https://localhost:9002/console/flexsearch#
When I run below query there is no error
SELECT
*
FROM { Customer AS p}
where p_name IS NOT NULL
But, when I run this, it's giving me an error.
SELECT *
FROM { Customer AS p}
where {p_name} =' zohan'
Confused between flexible and SQL query?
Hybris use flexible query syntax where you can simply use TypeCode (Customer) and their attribute(name) to make the query. Hybris internally convert your query to the respective database syntax. In DB each column name is prefixed with p_
. So if you want to directly use SQL query you should use p_name
otherwise with flexible search use model attributes name (name
in your case)
SELECT * FROM {Customer} WHERE {name} IS NOT NULL
Or
SELECT * FROM {Customer AS c} WHERE {c.name} IS NOT NULL
you can run from HAC > console > FlexibleSearch > SQL query
SELECT * FROM users WHERE p_name is not null
Refer FlexibleSearch Samples and other Tips and Tricks