<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ElasticSearch &#8211; Lhy&#039;s blog</title>
	<atom:link href="https://blog.lhyshome.com/tag/elasticsearch/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.lhyshome.com</link>
	<description>welcome</description>
	<lastBuildDate>Tue, 21 May 2024 10:13:34 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">219834889</site>	<item>
		<title>ES将已有索引结构及数据拷贝到新索引</title>
		<link>https://blog.lhyshome.com/2024/05/13/53/</link>
					<comments>https://blog.lhyshome.com/2024/05/13/53/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Mon, 13 May 2024 02:54:53 +0000</pubDate>
				<category><![CDATA[脚本]]></category>
		<category><![CDATA[ElasticSearch]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=53</guid>

					<description><![CDATA[查询旧索引的结构详情 创建索引，将原索引的settings和mappins拷贝到下方对应位置因为新的索引用不到… <span class="read-more"><a href="https://blog.lhyshome.com/2024/05/13/53/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<p>查询旧索引的结构详情</p>



<pre class="wp-block-code"><code>GET my_index</code></pre>



<pre class="wp-block-code"><code>{
  "resource_index": {
    "aliases": {},
    "mappings": {
      "properties": {
        "IS_DELETED": {
          "type": "long"
        },
        "ecsSshPort": {
          "type": "float"
        },
        "globalCloudProjectID": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          },
          "fielddata": true
        },
        "globalConfigurationCode": {
          "type": "text",
          "analyzer": "caseSensitive"
        },
        "globalFirstLevel": {
          "type": "keyword"
        },
        "globalTag": {
          "type": "text",
          "analyzer": "tags_analyzer"
        },
        "rdsList": {
          "properties": {
            "DBInstanceDescription": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "DBInstanceStatus": {
              "type": "long"
            },
            "ReadOnlyDBInstanceId": {
              "type": "object"
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_content"
            }
          }
        },
        "mapping": {
          "total_fields": {
            "limit": "2000"
          }
        },
        "number_of_shards": "5",
        <s>"provided_name": "resource_index",</s>
        "max_result_window": "1000000",
        <s>"creation_date": "1643186139977",</s>
        "analysis": {
          "analyzer": {
            "tags_analyzer": {
              "lowercase": "false",
              "pattern": ";",
              "type": "pattern"
            },
            "caseSensitive": {
              "filter": "lowercase",
              "type": "custom",
              "tokenizer": "keyword"
            },
            "default": {
              "type": "keyword"
            }
          }
        },
        "number_of_replicas": "1",
        <s>"uuid": "1_10JN9fTtKHJygzpQ7-qg",
        "version": {
          "created": "7150199"
        }</s>
      }
    }
  }
}</code></pre>



<p>创建索引，将原索引的settings和mappins拷贝到下方对应位置<br>因为新的索引用不到setting中的provided_name、creation_date、uuid、version.created等，复制到下方后将其剔除</p>



<pre class="wp-block-code"><code>PUT /my_index
{
  "settings": {
    ...
  },
  "mappings": {
    "properties": {
       ...
    }
  }
}</code></pre>



<p>将原索引数据导入到新索引中</p>



<pre class="wp-block-code"><code>POST _reindex
{
  "source": {
    "index": "现有的索引名称",
    "size":1000,
    "query": {
      "match_all": {} 
    }
   },
  "dest": {
    "index": "新索引名称"
  }
}</code></pre>



<p>成功返回结果，即新索引创建拷贝成功</p>



<pre class="wp-block-code"><code>{
  "took" : 319,
  "timed_out" : false,
  "total" : 7,
  "updated" : 0,
  "created" : 7,
  "deleted" : 0,
  "batches" : 1,
  "version_conflicts" : 0,
  "noops" : 0,
  "retries" : {
    "bulk" : 0,
    "search" : 0
  },
  "throttled_millis" : 0,
  "requests_per_second" : -1.0,
  "throttled_until_millis" : 0,
  "failures" : &#91; ]
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/05/13/53/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">53</post-id>	</item>
	</channel>
</rss>
