Indexing Resources

Indexing Resources

Property Reindexing

Step-1: Delete the index for property-services

curl -XDELETE http://elasticsearch-client-v1.es-cluster:9200/property-services-enriched

Step-2: Create new index

curl -XPUT -H "Content-Type: application/json"  http://elasticsearch-client-v1.es-cluster:9200/property-services-enriched?pretty

Step-3: Create a new alias

curl -XPOST "http://elasticsearch-client-v1.es-cluster:9200/_aliases" -H 'Content-Type: application/json' -d' {"actions" : [{ "add" : { "index" : "property-services-enriched", "alias" : "property-services" } } ]}'

Step-4: Delete the Kafka connector and create a new one

curl -X DELETE http://kafka-connect.kafka-cluster:8083/connectors/property-services-enriched-es-sink

Step-5: Create a new Kafka connector

curl -X POST \ http://kafka-connect.kafka-cluster:8083/connectors/ \ -H 'Content-Type: application/json' \ -H 'Cookie: SESSIONID=f1349448-761e-4ebc-a8bb-f6799e756185' \ -H 'Postman-Token: adabf0e8-0599-4ac9-a591-920586ff4d50' \ -H 'cache-control: no-cache' \ -d '{ "name": "property-services-enriched-es-sink", "config": { "connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector", "type.name": "licenses", "tasks.max": "1", "max.retries": "15", "key.ignore": "false", "retry.backoff.ms": "5000", "max.buffered.records": "2000", "value.converter": "org.apache.kafka.connect.json.JsonConverter", "errors.log.enable": "true", "key.converter": "org.apache.kafka.connect.storage.StringConverter", "read.timeout.ms": "10000", "topics": "property-services-enriched", "batch.size": "1000", "max.in.flight.requests": "2", "schema.ignore": "true", "behavior.on.malformed.documents": "warn", "flush.timeout.ms": "3600000", "errors.deadletterqueue.topic.name": "property-services-enriched-failed", "errors.tolerance": "all", "value.converter.schemas.enable": "false", "name": "property-services-enriched-es-sink", "connection.url": "http://elasticsearch-client-v1.es-cluster:9200", "linger.ms": "1000", "transforms": "TopicNameRouter", "transforms.TopicNameRouter.type": "org.apache.kafka.connect.transforms.RegexRouter", "transforms.TopicNameRouter.regex": "property-services-enriched*", "transforms.TopicNameRouter.replacement": "property-services-enriched" } }'

Step-6: Once Kafka connector is created , forward port 8080 for index pod

kubectl port-forward <indexer_name> -n egov 8080:8080

Step-7: Now run the reindexing curl command from outside the playground pod

curl -X POST \  http://egov-indexer.egov:8080/egov-indexer/index-operations/_legacyindex \  -H 'Cache-Control: no-cache' \  -H 'Content-Type: application/json' \  -H 'Postman-Token: d380bebb-383f-1b7c-76d1-10c1dc07dd06' \  -d '{     "RequestInfo": {         "apiId": "Rainmaker",         "ver": ".01",         "ts": "",         "action": "_create",         "did": "1",         "key": "",         "msgId": "20170310130900|en_IN",         "authToken": "34049f85-7ace-4a6c-8b43-8bc842b02d00",         "userInfo": {             "id": 150,             "userName": "TLCreator-Dehradun",             "name": "Mr  Om Prakash Jaiswal",             "type": "EMPLOYEE",             "mobileNumber": "9999999999",             "emailId": "free2jaiswal@Gmail.com",             "roles": [                 {                     "id": null,                     "name": "PT Document Verifier",                     "code": "PTDOCVERIFIER",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "Employee",                     "code": "EMPLOYEE",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "TL Counter Employee",                     "code": "TL_CEMP",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "PT Approver",                     "code": "PTAPPROVER",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "Trade License Document verifier",                     "code": "TL_DOC_VERIFIER",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "TL Approver",                     "code": "TL_APPROVER",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "PT Field Employee",                     "code": "PTFEMP",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "PT Counter Employee",                     "code": "PTCEMP",                     "tenantId": "uk.dehradun"                 },                 {                     "id": null,                     "name": "DATA ENTRY ADMIN",                     "code": "DATAENTRY_ADMIN",                     "tenantId": "uk.dehradun"                 }             ],             "tenantId": "uk.dehradun",             "uuid": "9a3bbbdb-c5a6-4405-a098-90ebffdc34e1"         }     },     "apiDetails": {         "uri": "http://property-services:8080/property-services/property/_plainsearch",         "paginationDetails": {             "offsetKey": "offset",             "sizeKey": "limit",             "maxPageSize": 100,             "startingOffset": 0         },         "responseJsonPath": "$.Properties"     },     "legacyIndexTopic": "property-registry-legacyIndex",     "tenantId": "uk.dehradun" }