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

  • 相关阅读:
    HDU1029 Ignatius and the Princess IV
    UVA11039 Building designing【排序】
    UVA11039 Building designing【排序】
    POJ3278 HDU2717 Catch That Cow
    POJ3278 HDU2717 Catch That Cow
    POJ1338 Ugly Numbers(解法二)
    POJ1338 Ugly Numbers(解法二)
    UVA532 Dungeon Master
    UVA532 Dungeon Master
    POJ1915 Knight Moves
  • 原文地址:https://www.cnblogs.com/zxbdboke/p/14563605.html
Copyright © 2011-2022 走看看