ElasticSearch比较查询搜索

pvcm50d1  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(0)|浏览(297)

我正在使用elasticsearch,我有以下文档的索引:

{"distancestart": 1.34, "distanceend": 1.52, "event": "case1"}, 
{"distancestart": 1.7, "distanceend": 1.85, "event": "case2"}, 
{"distancestart": 7.91, "distanceend": 8.36, "event": "case3"}, 
{"distancestart": 12.2, "distanceend": 14.85, "event": "case1"}
{"distancestart": 22.2, "distanceend": 24.85, "event": "case2"}...... so on

我想创建一个基于“distancestart”和“event”的查询-例如“case1”靠近“case2”(顺序无关紧要),其中case1和case2的开始距离之间的差异不应大于“2.0”
在上面的场景中,它应该会返回给我-

{"distancestart": 1.34, "distanceend": 1.52, "event": "case1"}, 
{"distancestart": 1.7, "distanceend": 1.85, "event": "case2"}

提前谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题