zoukankan      html  css  js  c++  java
  • elasticsearch7.x-reindex

    同一集群条件查询一个索引的数据插入到另一个索引

    限制条件:指定需要的字段及确定的返回数据条数

    示例:

    POST _reindex
    {
      "size": 5,
      "source": {
        "index": "movies",
        "_source": [
          "genre",
          "title"
        ],
        "sort": {
          "genre.keyword": "desc"
        },
        "query": {
          "match": {
            "title": "Dracula"
          }
        }
      },
      "dest": {
        "index": "reindex_20210306"
      }
    }

    结果:

    {
      "took" : 1,
      "timed_out" : false,
      "_shards" : {
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : {
          "value" : 5,
          "relation" : "eq"
        },
        "max_score" : 1.0,
        "hits" : [
          {
            "_index" : "reindex_20210306",
            "_type" : "_doc",
            "_id" : "1339",
            "_score" : 1.0,
            "_source" : {
              "genre" : [
                "Fantasy",
                "Horror",
                "Romance",
                "Thriller"
              ],
              "title" : "Dracula"
            }
          },
          {
            "_index" : "reindex_20210306",
            "_type" : "_doc",
            "_id" : "6665",
            "_score" : 1.0,
            "_source" : {
              "genre" : [
                "Horror",
                "Romance"
              ],
              "title" : "Dracula"
            }
          },
          {
            "_index" : "reindex_20210306",
            "_type" : "_doc",
            "_id" : "2653",
            "_score" : 1.0,
            "_source" : {
              "genre" : [
                "Horror"
              ],
              "title" : "Son of Dracula"
            }
          },
          {
            "_index" : "reindex_20210306",
            "_type" : "_doc",
            "_id" : "2644",
            "_score" : 1.0,
            "_source" : {
              "genre" : [
                "Horror"
              ],
              "title" : "Dracula"
            }
          },
          {
            "_index" : "reindex_20210306",
            "_type" : "_doc",
            "_id" : "4030",
            "_score" : 1.0,
            "_source" : {
              "genre" : [
                "Horror"
              ],
              "title" : "Dracula 2000"
            }
          }
        ]
      }
    }

    官方地址:https://www.elastic.co/guide/en/elasticsearch/reference/7.2/docs-reindex.html

  • 相关阅读:
    面向对象一
    模块二:os模块、sys模块、json模块、pickle模块,包
    模块一:时间模块、random模块、hashlib模块、日志模块
    异常处理、迭代器、推导式、生成器
    有参装饰器
    匿名函数、高阶函数
    装饰器
    函数对象、函数嵌套、闭包函数
    名称空间与作用域
    day17 django 相关
  • 原文地址:https://www.cnblogs.com/zxbdboke/p/14563605.html
Copyright © 2011-2022 走看看