-
Notifications
You must be signed in to change notification settings - Fork 89
通用搜索查询
iamazy edited this page Nov 25, 2019
·
10 revisions
select productName from apple;
select * from apple where minPrice > 5000;
select ^productName,minPrice from apple;
select ^product*,min* from apple
select * from apple where provider is not null;
match -> ~= // not match -> !~=
match_all -> 没有where条件查询
match_phrase -> ~== // not match_phrase -> !~==
match_phrase_prefix -> ~=== //not match_phrase -> !~===
multi_match -> (,,)~=
query_string -> query by 'text....'
# not support simple_query_string
simple_query_string
以上使用sql分别为
select * from apple where provider~='苹果';
select * from apple;
select * from apple where provider~=='苹果';
select * from apple where provider~==='苹果';
select * from student where (name,age) ~= 'hahah'
select * from apple where query by '苹果';
--- not support simple_query_string
term
terms
fuzzy
prefix
regexp
wildcard
以上使用sql分别为
select * from apple where provider='苹果' // not equal -> !=
select * from apple where provider in ('苹果','apple');
select * from apple where provider fuzzy like 'ca'; --fuzzy
select * from apple where provider prefix like 'ca'; --prefix
select * from apple where provider wildcard like 'ki*y'; --wildcard
select * from apple where provider like 'k.*y'; -- regexp
select * from apple where provider regexp like 'k.*y'; -- regexp
语法: where not [expression]
示例
select * from aaa where (not provider ~=== 'apple') or provider !~='microsoft'