有人可以向我解释一下 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。
我正在将诸如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 秒报告一次值并截断毫秒?
我正在尝试在 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) 我试图解决这个简单的问题,如果在一个有"知道"关系的图形中,某个人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方法,那也没关系.