小编wag*_*oon的帖子

完整的点路径(任何级别路径),在dynamic_templates中具有path_match

我有这个文件

{
    "text_foo": "lorem ipsum",
    "one":{
        "two":{
            "three":{
                "text_bar": "dolor sit amet"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我想要完成的事情:我需要动态模板,它将匹配以“text_”开头的任何属性示例:

"mappings" : {
    "dynamic_templates":[
    {
            "text":{
                "match": "text_*",
                "path_match": "*.text_*",
                "match_mapping_type": "*",   
                "mapping":{"type":"text","analyzer":"myCustomAnalyzer"}
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

问题一:

"match"和可以"path_match"一起使用吗?(就像我的例子一样)

问题2:

"path_match":"*.text_*"匹配整个路径"one.two.three.text_*"还是仅匹配“one.text_*”?

问题3:

也会"path_match":"*.text_*"匹配 root 属性吗"text_foo"

问题4:

如果唯一的解决方案是使用正则表达式 ( "match_pattern":"regex"),则正则表达式将匹配整个路径"one.two.three.text_bar"还是仅匹配"text_bar"

mapping elasticsearch elasticsearch-mapping elasticsearch-template

6
推荐指数
0
解决办法
674
查看次数

Vue.js 3 卸载和内存泄漏

为了这篇文章的目的,我创建了一个简单的示例: http://wagoon.demoeshop.net/test-remove-vue.html

在此示例中,您会发现两个按钮。

  • 第一个按钮创建DIV元素,然后创建一个 Vue 应用程序并将其安装到该应用程序div
  • 第二个按钮将取消安装应用程序

示例代码

在我的示例中,您会发现两个按钮

<button type="button" onclick="myTest.mount()">.mount()</button>
<button type="button" onclick="myTest.unmount()">.unmount()</button>
Run Code Online (Sandbox Code Playgroud)

包含 Vue.js 3

<script src="https://unpkg.com/vue@next"></script>
Run Code Online (Sandbox Code Playgroud)

testClass()出于调试原因,整个 javascript 代码都包装在函数中:

function testClass(){

   // vueApp is public just for debugging reasons
   this.vueApp = null;

   // creates DIV with id #appDiv and apends it to <body>
   function createDiv(){
      var div = document.createElement('div');
      div.id = "appDiv";
      document.body.append(div);
   }

   // creates new Vue app and mounts it to #appDiv
   this.mount = function(){
      createDiv();
      this.vueApp = Vue.createApp({"template":"Vue mounted"}); …
Run Code Online (Sandbox Code Playgroud)

memory-leaks vue.js vuejs3

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