暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

​肝胆相照的 ES 和 Mysql

让代码飞 2021-05-21
147

肝胆相照的 ES 和 Mysql

概念

ESSQL
Indexdatabase
Typetable
Documentrow

CURD

SQL
ES
curl -X PUT ‘ip:9200/ [ index ] / [ type ] / [ id ] ’
curl -X DELETE ‘ip:9200/ index ] / type id 
curl -X POST ‘ip:9200/ index ] / type id /_update’
curl -X GET ‘ip:9200/ index ] / type id 
curl -X GET ‘ip:9200/ index ] / type /_search’

花式操作

FuncSQLES
条件限制where field =query.match.field.value
字段过滤select field_source : [field, field]
排序order bysort : [filed.order.desc]
分页offsetfrom
分页limitsize
andquery.bool.must.match.field.value
orquery.bool.should.match.field.value
notquery.bool.must_not.match.field.value
大于等于>=query.bool.filter.range.field.gte.value
小于等于<=query.bool.filter.range.field.lte.value
  • term 使用倒排索引精确查询,match 使用分词器模糊查询

  • 字段类型 : text 会被分词器解析,keyword 不会

  • hits.hits._score : 匹配度

  • hits.hits._source : 源数据

文章转载自让代码飞,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论