1.7.20 • Published 8 years ago

mqes v1.7.20

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

将mongo的query语句转化成es的

单纯的分析mongo中查询关键词, 并转化

elastic version 1.7

目标

不是做一个完全的兼容转化, 选取mongo查询语法和es查询功能的一个共有子集, 对应起来

映射关系

  • $eq, $ne
  • $gt, $gte, $lt, $lte
  • $in, $nin
  • $regex
  • $exists
  • $size
  • $and
  • $or
  • $not
  • $and $or $not 嵌套

变相支持

  • $text:
{tags_string:{$text: '1boy'}}

{tags_string:{$text: '1boy head'}} // eq: tags_string like 1boy or head

{tags_string:{$text: '1boy AND head'}} // eq: tags_string like 1boy AND head
  • $script:
{any:{$script: "doc['num1'].value > 1"}} // 1: any 部分写什么都行, 仅是为了统一语法中的先写字段名的规则, 转化后会忽略,
{anx:{$script: "doc['num1'].value > 1"}} // 2: 与上行是等价的
{any:{$script: {script: "doc['num1'].value > p1", params: {p1: 2}}}} // 3: 可以设置参数

不支持

  • $nor

测试

curl -XPOST -H "Content-Type: application/json" --data '{"width":1}' http://bili.xroom.3322.org/api/dev/mq2es

1.7.20

8 years ago

1.7.5

8 years ago

1.7.4

8 years ago

1.7.3

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago