java - 弹性搜索查询
问题描述
我是弹性搜索的新手 我有这样的查询
select
distinct count(distinct user0_.id) as col_0_0_
from
user user0_ cross
join
account account1_
inner join
user_detail userdetails_1
on user0_.user_detail_id=userdetails_1.id
inner join
level level3_
on userdetails_1.level_id=level3_.id
inner join
credential credential4_
on account1_.id=credential4_.account_id
where
user0_.status_id='published'
and userdetails_1.program_type_id='spp'
and level3_.active=1
and (
userdetails_1.status_id not in (
'submitted-in-review' , 'expired' , 'rejected'
)
)
and (
userdetails_1.account_id=account1_.id
or userdetails_1.crm_record_id=account1_.global_partner_account
or userdetails_1.crm_record_id=account1_.top_parent
)
and (
credential4_.type='Certification'
and credential4_.active=1
or credential4_.type='Professional Certification'
or credential4_.type='Sales Certification'
)
and (
credential4_.solution_category_id in (
'test'
)
)
我需要将此查询转换为弹性搜索查询。
解决方案
如果要查询索引,可以直接在开发工具中编写查询,如下所示:
POST _xpack/sql?format=txt
{
"query":"DESCRIBE \"indice-name-*\""
}
POST _xpack/sql
{
"query":"Select data1, data2 from \"indice-name-*\" where data1 = 'ABC' and ID = '11223333'"
}
推荐阅读
- python - Python - 将数据帧中的值附加到相应的元组元素
- sql - 从 Oracle 中的 XML 列中提取值
- excel - 如何从大型数据集中的列中提取唯一项目列表
- excel - 如何在vba excel中按多个分隔符分割
- angular - 我如何在角度应用程序中使用 xlsx 库删除列
- here-api - HERE 地图 - 如何检测地图中心是否自原始位置移动?
- azure-cognitive-search - 如何在 Azure Search Suggester 中选择分析器(或语言)
- javascript - 如何将 Google App Script 结果返回到外部网页?
- c++ - 在 C++ 中的 SetClipboardData() 之后粘贴不包括记事本的换行符
- wagtail - 禁用 Wagtail “复制”功能