小编sch*_*ida的帖子

elasticsearch中must_not和filter的区别

有人可以向我解释一下 elasticsearch 中 must_not 和 filter 之间的区别吗?

例如这里(取自elasticsearch 权威指南),为什么 must_not 不也用于范围?

{
    "bool": {
        "must":     { "match": { "title": "how to make millions" }},
        "must_not": { "match": { "tag":   "spam" }},
        "should": [
            { "match": { "tag": "starred" }}
        ],
        "filter": {
          "range": { "date": { "gte": "2014-01-01" }} 
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

具体看这个文档,在我看来它们是完全一样的:

filter:子句(查询)必须出现在匹配的文档中。然而,与 must 不同的是,查询的分数将被忽略。过滤器子句在过滤器上下文中执行,这意味着忽略评分并考虑缓存子句。

must_not:子句(查询)不得出现在匹配的文档中。子句在过滤器上下文中执行,这意味着忽略评分并考虑将子句用于缓存。由于评分被忽略,所有文档的评分为 0。

elasticsearch

11
推荐指数
2
解决办法
5798
查看次数

Grafana / Influxdb:不同客户端记录的价值总和

我正在将诸如memory_used 之类的系列与使用 influxdb-java 客户端的几个客户端一起录制到 InfluxDB 数据库中。数据如下所示:

1449433668 19292838 client=clientA
1449433999 24448880 client=clientB
Run Code Online (Sandbox Code Playgroud)

我可以使用 grafana 轻松绘制按标签分组的内存使用情况,但是我找不到一种方法来总结所有客户端的总内存消耗。当使用 avg(memory_used) 或 sum(memory_used) 时,这些值会变大并且会波动。我认为这是因为根据报告的时间间隔(并不完全相同),同一客户端的值可能会被多次相加。

在这种情况下,如何总结总内存消耗?我应该对我的客户进行编码吗?总是每 5 秒报告一次值并截断毫秒?

influxdb grafana

5
推荐指数
1
解决办法
2282
查看次数

具有固定纵横比的 ExoPlayer 布局

我正在尝试在 Android 上使用 ExoPlayer 构建类似 YouTube 的视图。我希望视频出现在顶部,然后是一些其他内容,如标题、描述等。我所有的视频都是 16:9,我希望SimpleExoPlayerView以 16:9 布局开始。使用下面的布局,播放器在切换到正确的视频纵横比之前占据整个屏幕几秒钟:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:keepScreenOn="true">

  <com.google.android.exoplayer2.ui.SimpleExoPlayerView android:id="@+id/player_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:resize_mode="fixed_width">

  </com.google.android.exoplayer2.ui.SimpleExoPlayerView>

  <TextView
    android:id="@+id/text_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:text="VideoTitle"
    android:textAppearance="@style/TextAppearance.AppCompat.Title" />

  <TextView
    android:id="@+id/text_description"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:text="description" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android exoplayer

4
推荐指数
2
解决办法
6310
查看次数

测试neo4j/spring数据中是否存在关系

我试图解决这个简单的问题,如果在一个有"知道"关系的图形中,某个人A知道某个人B.理想情况下,我会用真或假回答这个问题,但我没有解决这个问题.

我在另一个StackOverflow问题中发现了以下内容,这几乎是我想要的,除了回答我的问题之外,它还会更改图表:

MATCH  (p:Person {userId: {0}}), (b:Person {userId: {1}}) 
MERGE (p)-[r:KNOWS]->(b) 
ON CREATE SET r.alreadyExisted=false 
ON MATCH SET r.alreadyExisted=true 
RETURN r.alreadyExisted;
Run Code Online (Sandbox Code Playgroud)

最后我想把它放在像这样的Spring Neo4J存储库中

public interface PersonRepository extends GraphRepository<Person> {
    boolean knows(final Long me, final Long other);
}
Run Code Online (Sandbox Code Playgroud)

这意味着如果有一种方法可以在没有cypher的情况下使用Spring Query和Finder方法,那也没关系.

neo4j cypher spring-data-neo4j

0
推荐指数
2
解决办法
4980
查看次数