• Eclipse
    2019-08-10
    #Index Alias 经测试,可以对不同的索引起相同的别名
    DELETE /titles
    DELETE /titles2
    PUT /titles
    {
      "mappings": {
        "properties": {
          "title": {
            "type": "text",
            "analyzer": "english",
            "fields": {"std": {"type": "text","analyzer": "standard"}}
          }
        }
      }
    }
    PUT /titles2
    {
      "mappings": {
        "properties": {
          "title": {
            "type": "text",
            "analyzer": "english",
            "fields": {"std": {"type": "text","analyzer": "standard"}}
          }
        }
      }
    }
    POST titles/_bulk
    { "index": { "_id": 1 }}
    { "title": "My dog barks" }
    { "index": { "_id": 2 }}
    { "title": "I see a lot of barking dogs on the road " }
    POST titles2/_bulk
    { "index": { "_id": 3 }}
    { "title": "My dog barks" }
    { "index": { "_id": 4 }}
    { "title": "I see a lot of barking dogs on the road " }
    POST _aliases
    {
      "actions": [
        {
          "add": {
            "index": "titles",
            "alias": "aliastitle"
          }
        }
      ]
    }
    POST _aliases
    {
      "actions": [
        {
          "add": {
            "index": "titles2",
            "alias": "aliastitle"
          }
        }
      ]
    }
    GET /aliastitle/_search
    {
       "query": {
            "multi_match": {
                "query": "barking dogs",
                "type": "most_fields",
                "fields": [ "title", "title.std" ]
            }
        }
    }
    GET /aliastitle/_search
    {
       "query": {
            "multi_match": {
                "query": "barking dogs",
                "type": "most_fields",
                "fields": [ "title^10", "title.std" ]
            }
        }
    }
    展开

    作者回复: alias可以指定多个index,但是只能指定一个index用于写入数据

    
     3
  • 付坤
    2019-07-31
    如果别名是精确到某天的话,那就需要每天来更新别名了吧?有没有方式让它默认一直是当天索引的别名?

    作者回复: 别名不用写上具体日期,你可以写成today。然后每天凌晨可以由一个job,把他刷到新的index上

    
     2
  • lizhaochao
    2019-09-29
    POST tmdb/_search/template
    这一行的 tmdb是索引名吗
    
     1
  • godtrue
    2019-09-21
    搜索模板——解藕开发
    索引别名——停机维护
    
     1
  • 小宇宙
    2019-08-12
    老师您好,请教下您举例这个 "id":"tmdb",这个是什么意思,必须指定吗?
    POST _scripts/tmdb
    {
      "script": {
        "lang": "mustache",
        "source": {
          "_source": [
            "title","overview"
          ],
          "size": 20,
          "query": {
            "multi_match": {
              "query": "{{q}}",
              "fields": ["title","overview"]
            }
          }
        }
      }
    }

    POST tmdb/_search/template
    {
        "id":"tmdb",
        "params": {
            "q": "basketball with cartoon aliens"
        }
    }
    展开

    作者回复: 第一个是定义了一个search template,名字就叫tmdb,第二个是在用这个template

    所以tmdb只是个名,你可以按照自己的需求取有意义的名字

    
     1
  • limu
    2019-07-28
    这一节太有用了

    作者回复: 能否分享一下为什么有用?解决了实际工作中怎么样的问题?

     1
     1
  • A圆规
    2019-09-21
    创建索引模板,并设置了mapping ,往索引中写入数据后没有异常但索引中找不到写入的文档这种问题怎么处理?
    
    
  • Geek_2e09f0
    2019-08-22
    老师,代码演示在github上给的不全,aliases相关部分没有

    作者回复: 已经更新了

    
    
  • 银太@巨益科技
    2019-07-30
    请教老师,如果script里如何定义可选参数?
    
    
  • limu
    2019-07-28
    两个索引的别名可以一样吗?

    作者回复: 应该不可以的吧

     3
    
我们在线,来聊聊吧