| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
10年前发布

一个简单的,安全的,ElasticSearch查询编译器:FiltrES.js

一个简单的,安全的,ElasticSearch查询引擎,让你或你的最终用户输入任意表达式,而不需要学习ElasticSearch查询语言。

(height <= 73 or (favorites.color == "green" and height != 73)) and firstname ~= "o.+"

特性

  • Simple! End user expression language looks like this transactions <= 5 and profit > 20.5
  • Fast! Expressions get compiled into native ElasticSearch queries, offering the same performance as if it had been hand coded. e.g. {"filtered" : {"filter" : {"bool" : {"must" : {"term" : { "tag" : "wow" }}, "must_not" : {"range" : {"age" : { "from" : 10, "to" : 20 }}}
  • Safe! Expressions cannot escape the sandbox client-side or inside of ElasticSearch.
  • Predictable! Because users can't define loops or recursive functions, you know you won't be left hanging.

10 秒教程(using ElasticSearchClient)

// A search filter  var expression = 'transactions <= 5 and profit > 20.5';    // Compile expression to executable function  var myQuery = filtres.compile(expression);    // Execute query  esc.search("filtres", "accounts", myQuery, function (err, accounts) {      ...  });

项目主页:http://www.open-open.com/lib/view/home/1418373039042

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1418373039042.html
ElasticSearch 搜索引擎 FiltrES.js