莫小豆
莫小豆
这家伙很懒,什么也没写!

注册于 7年前

回答
98
文章
65
关注者
2

  1. 假设文档如下,首先在nested子文档里增加一个weight字段
[{
  "title": "Investment secrets",
  "body":  "What they don't tell you ...",
  "tags":  [ "shares", "equities" ],
  "comments": [
    {
      "id": 12313,
      "city": "Pune",
      "name":    "Mary Brown 1",
      "comment": "Lies, lies, lies ",
      "date":    "2018-10-18",
      "weight": 1
    },
    {
      "id": 12314,
      "city": "Pune",
      "name":    "Mary Brown 1",
      "comment": "Lies, lies, lies ",
      "date":    "2018-10-20"
      "weight": 1
    }
  ]
},
{
  "title": "Investment secrets",
  "body":  "What they don't tell you ...",
  "tags":  [ "shares", "equities" ],
  "comments": [
    {
      "id": 12315,
      "city": "Pune",
      "name":    "Mary Brown ",
      "comment": "Lies, lies, lies ",
      "date":    "2018-10-18",
      "weight": 1
    },
    {
      "id": 12316,
      "city": "Bangalore",
      "name":    "Mary Brown ",
      "comment": "Lies, lies, lies ",
      "date":    "2018-10-20",
      "weight": 1
    }
  ]
}]
  1. 然通过对comment.weight 进行sum排序即可:
POST blogs/_search
{
  "sort": [
    {
      "comments.weight": {
        "mode": "sum",
        "order": "desc",
        "missing": "0", 
        "nested": {
          "path": "comments",
          "filter": {
            "bool": {
              "must": [
                {
                  "match": {
                    "comments.city": "Pune"
                  }
                }
              ]
            }
          }
        }
      }
    }
  ]
}

这种情况应该给inner_hits起别名,在inner_hits里使用name参数:
image.png

参照官网的例子:https://www.elastic.co/guide/en/elasticsearch/reference/7.14/nested.html
如图,返回的hits里含有inner_hits,主hits是全部的文档,而inner_hits是符合的子文档。
image.png

除了修改application.yml里的mapper-locations还需要设置pom.xml里resources位置

在pom文件的build标签里增加:

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.json</include>
                    <include>**/*.ftl</include>
                </includes>
            </resource>
        </resources>

image.png

可以通过网络在主机中开启shell的服务。比如使用'scp'命令 远程传输文件时就会启动

标题doGetAuthenticationInfo执行前提:

当调用Subject currentUser = SecurityUtils.getSubject();

currentUser.login(token);

doGetAuthorizationInfo 执行的前提:

必须在对应的操作(比如控制器)加上权限认证。:

  1. subject.hasRole(“admin”) 或 subject.isPermitted(“admin”):自己去调用这个是否有什么角色或者是否有什么权限的时候;
  2. @RequiresRoles("admin") :在方法上加注解的时候;
  3. @shiro.hasPermission name = "admin":在页面上加shiro标签的时候,即进这个页面的时候扫描到有这个标签的时候。

java 原生是不支持 ripemd160 得引用第三方插件:Bouncy Castle Provider
具体可以参考:点击查看

备份有两种方法,迁移的话用方法一:
1.备份 配置文件 和 qcow2磁盘文件。具体看参照:点击
这种方法可以在不同宿主机间还原。
2.使用virsh snapshot生成和还原快照。

如何是基于Debian的镜像可以这样安装(其他系统大同小异):

// 安装 msgpack
pecl install msgpack

docker-php-ext-enable msgpack


// 然后安装 libcurl4-openssl-dev 和 yar
apt-get update && apt-get install --no-install-recommends -y libcurl4-openssl-dev

pecl install yar

yar 的 rpc 是基于curl的。curl有并发问题,你先检查一下服务器是不是还有其他服务同时在使用curl功能。有的话,先关掉试试。

首先我们要明白,网页的打开速度会影响搜索引擎爬虫的速率,对应爬虫来讲,sitemap.xml可以归类成网页。同时,sitemap.xml最多能放5W个url

所以你如果在意搜索引擎的爬虫速率的话,应该根据自己的服务器性能来调整大小。

apt-get update && apt-get install --no-install-recommends -y libcurl4-openssl-dev

发布
问题