blog-post

Manticore के साथ Elasticdump का उपयोग कैसे करें

Elasticdump एक उपकरण है जिसका उपयोग Elasticsearch और OpenSearch में डेटा प्रबंधन और माइग्रेशन के लिए किया जाता है। Elasticdump उपयोगकर्ताओं को डेटा को JSON फ़ाइल में निर्यात करने और फिर इसे किसी अन्य स्थान पर आयात करने के द्वारा अनुक्रमणिका को स्थानांतरित और सहेजने की अनुमति देता है। इस कार्यक्षमता का उपयोग बैकअप और पुनर्प्राप्ति के उद्देश्यों के लिए किया जाता है, और विभिन्न वातावरणों (जैसे विकास से उत्पादन में) के बीच डेटा माइग्रेट करने के लिए।

अब आप Elasticdump का उपयोग करके अपने Elasticsearch/OpenSearch अनुक्रमणिका को Manticore में भी आयात कर सकते हैं। आपके पास उपलब्ध दो विकल्पों में से एक चुन सकते हैं: पूरी अनुक्रमणिका का आयात करना या केवल इसके स्कीमा का आयात करना।

स्कीमा और डेटा आयात करना

Manticore में डेटा सहित अनुक्रमणिका की कॉपी करने के लिए आप निम्नलिखित आदेश का उपयोग कर सकते हैं:

elasticdump --input=http://localhost:9200/your_elasticsearch_or_opensearch_index  --output=http://localhost:9308/your_manticore_table --type=data

आइए इसे उपयोग करने का एक सरल उदाहरण देखें। यहाँ एक मूल Elasticsearch अनुक्रमणिका है जिसका नाम test है और यह स्कीमा है:

# curl -sX GET localhost:9200/test/_mapping

{
  "test": {
    "mappings": {
  	"properties": {
    	  "price": {
          "type": "float"
    	  },
    	  "title": {
          “type": "text"
    	  }
  	}
    }
  }
}

और इसमें 300 दस्तावेज हैं:

# curl -sX GET localhost:9200/test/_count

{
  "count": 300,
  "_shards": {
	"total": 1,
	"successful": 1,
	"skipped": 0,
	"failed": 0
  }
}

अब तक, हमारे पास Manticore में कोई तालिका नहीं है:

# curl -sX GET localhost:9308/cli -d 'SHOW TABLES'

Empty set (0.000 sec)

अब, आइए Elasticdump चलाते हैं:

# elasticdump --input=http://localhost:9200/test --output=http://localhost:9308/test_imported --type=data

Tue, 26 Feb 2024 16:18:52 GMT | starting dump
(node:156) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Tue, 26 Feb 2024 16:18:52 GMT | got 300 objects from source elasticsearch (offset: 0)
Tue, 26 Feb 2024 16:18:52 GMT | sent 300 objects to destination elasticsearch, wrote 300
Tue, 26 Feb 2024 16:18:52 GMT | got 0 objects from source elasticsearch (offset: 300)
Tue, 26 Feb 2024 16:18:52 GMT | Total Writes: 300
Tue, 26 Feb 2024 16:18:52 GMT | dump complete

और हमने जो आयात किया है उसके परिणामों की जाँच करें:

# curl -sX GET localhost:9308/cli -d 'DESC test_imported'

+-------+--------+----------------+
| Field | Type   | Properties     |
+-------+--------+----------------+
| id	| bigint |                |
| title | text   | indexed stored |
| price | float  |                |
+-------+--------+----------------+
3 rows in set (0.000 sec)
# curl -sX GET localhost:9308/cli -d 'SELECT COUNT(*) FROM test_imported'

+----------+
| count(*) |
+----------+
| 300      |
+----------+
1 row in set (0.000 sec)

हम देख सकते हैं कि तालिका की प्रतिलिपि बनाई गई है।

केवल स्कीमा आयात करना

केवल तालिका स्कीमा आयात करने के लिए, चलाएँ:

# elasticdump --input=http://localhost:9200/your_elasticsearch_or_opensearch_index --output=http://localhost:9308/your_manticore_table --type=mapping

आपको मूल नोड से आयात की गई संरचना के साथ एक नया खाली Manticore तालिका मिलेगी।

ध्यान रखें कि उपरोक्त उदाहरणों में डिफ़ॉल्ट Elasticsearch और Manticore पोर्ट का उपयोग किया गया है: localhost:9200 और localhost:9308, क्रमशः। यदि आप Elasticsearch, OpenSearch या Manticore से कनेक्ट करने के लिए अन्य होस्ट/पोर्ट का उपयोग करते हैं, तो आपको अपने आदेश को उपयुक्त रूप से बदलना चाहिए।

इसके अलावा, यह ध्यान रखें कि Manticore कुछ Elasticsearch डेटा प्रकारों को अपने स्वयं के प्रकारों में परिवर्तित करता है, यदि यह उन्हें आंतरिक रूप से समर्थन नहीं करता है:

  • aggregate_metric => json
  • binary => string
  • boolean => bool
  • byte => int
  • completion => string
  • date => timestamp
  • date_nanos => bigint
  • date_range => json
  • dense_vector => json
  • flattened => json
  • flat_object => json
  • float => float
  • float_range => json
  • geo_point => json
  • geo_shape => json
  • half_float => float
  • histogram => json
  • integer => int
  • integer_range => json
  • ip => string
  • ip_range => json
  • keyword => string
  • knn_vector => float_vector,
  • long => bigint
  • long_range => json
  • match_only_text => text
  • object => json
  • point => json
  • scaled_float => float
  • search_as_you_type => text
  • shape => json
  • short => int
  • text => text
  • unsigned_long => int
  • version => string

उदाहरण के लिए, यदि आप एक Elasticsearch अनुक्रमणिका को इस प्रकार आयात करते हैं:

{
 "test": {
   "mappings": {
     "properties": {
       "location": {
         "type": "geo_point"
       },
       "title": {
         "type": "text"
       }
     }
   }
 }
}

तो आयातित Manticore तालिका की स्कीमा इस प्रकार होगी:

+----------+--------+----------------+
| Field    | Type   | Properties     |
+----------+--------+----------------+
| id       | bigint |                |
| title    | text   | indexed stored |
| location | json   |                |
+----------+--------+----------------+

निष्कर्ष

निष्कर्ष में, Manticore Search अब Elasticdump का समर्थन करता है, जिससे उपयोगकर्ताओं के लिए Elasticsearch या OpenSearch से Manticore में जाना सरल हो गया है। यह अपडेट माइग्रेशन प्रक्रिया को सरल बनाता है, जिससे उपयोगकर्ताओं को डेटा और स्कीमा को सुगमता से स्थानांतरित करने की अनुमति मिलती है। यह उन लोगों के लिए एक बड़ा कदम है जो जटिल डेटा स्थानांतरण की परेशानी के बिना Manticore Search पर स्विच करने की सोच रहे हैं। इस एकीकरण का अर्थ है एक सीधा माइग्रेशन जो आपके डेटा को सुरक्षित रखता है, जिससे Manticore Search खोज क्षमताओं को बढ़ाने के लिए एक आकर्षक विकल्प बन जाता है।

मैंटीकोर सर्च इंस्टॉल करें

मैंटीकोर सर्च इंस्टॉल करें