---
# System prepended metadata

title: 'Cyber support  : Analysing tickets'

---

# Cyber support  : Analysing tickets

## Points to be considered :
1. Before indexing a sku document its checked for fields marked as mandatory in schema, if those are present then only it will be part of index through the Full indexing job
2. sku won't be shown if that is not matching criteria for passed filters in /search/v1/query api body
    * ex : variant.isSellable flag 
* search publishing rules.:  https://confluence.falabella.tech/display/BPSP/Search+Publishing+Rules
    * chwck the above link for all the mandatory fields and isSellable expressions.

## Data validation : 
    Checing for corretnees of the data in search with rrespect to source systems.There are two places where search serves the data from 
    1. Postgres DB
    2. Elasticsearch index 
**$ : To check the data in Postgres DB. :**
    1. get project credentials using below command on terminal 
    ```
    gcloud container clusters get-credentials falabella-search-prod-cluster --region us-east4 --project falabella-search-prod
    ```
    2. we need to login to postgres instance through active jumpbox. for that
    get current jumpbox name using 
    ``` kubectl get pods ```
    3 . open interactive terminal inside the jumpbox (```kubectl exeec -it jumpbox-name -- /bin/bash```) and install psql (``` apt-get update && apt-get install -y postgresql-client telnet wget curl net-tools vim nginx```)
    4. login to the search database with psql commnad as below 
    ``` psql -h postgres.search.internal. -U catalyst_search -d search```
    5. Fire select PSQL querues to check for data in sku_documents table 
    Example : 
    ``` select data->'product'->'id' as product_id,document_id as variant_id,data->'product'->'isActive' as pActive ,data->'product'->'isPublished' as ppublished, data->'variant'->'isActive' as vActive , data->'variant'->'isPublished' as vPublished , 
jsonb_array_length(data->'availability'->'availableZones') as no_of_zones,
data->'variant'->'hasActiveOffering' as activeoffering,
jsonb_array_length(data->'product'->'parentCategoryPaths') as no_of_catPaths,
(data->'product'->'parentCategoryIds') as cat_ids,
data->'product'->'merchantCategoryId'  as merchantCategoryId,
data->'product'->'productType'  as productType,
data->'variant'->'attribute.groupId',
data->'variant'->'custom.forceUnpublished' as forceUnpublished,
data->'price'->'normal.default' as price,
modified_at
from sku_documents 
where tenant_id ='459e48c3-9637-4ec3-8e02-002a995b31af'
and document_id in ('324718X'); ```
    6. If any data mismatch is there ,do check in **events** table for the particukar entity
| type    | id        |
| ------- | --------- |
| product | productId |
| variant | variantId |
| other types such as price, availability etc. |         variantId_offeringIDd |


**$ : To check data in elasticsearch index :**
port forward to elastic through jumpbox and query using the documentId or variantId etc.
1. To port forward to elastic below commnad 
    ``` kubectl port-forward jumpbox-name localPort:remotePort
     kubectl port-forward jumbox-name 8080:80 
2. Using elastics query APIs check for particular document/sku
    * . API curl :
``` CURL    
curl --location --request GET 'localhost:8080/80ef7ae6-c10b-4684-8b2f-79d0bb4d91b5-products/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
    "from": 0,
    "size": 1,
    "explain":"true",
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "variant.id":"113572364"
                    }
                }
            ]
        }
    }
}'
```

## Comparing data between systems through beta dashboard 
https://beta.falabella.com/dashboard/variant/

---

# APPENDIX 

## Tenants 
```
Falabella Search Prod
FACL: f6adf6a4-7d13-4485-87dd-f78d5997543c
FACO: b0ea9675-3486-4b11-868e-0d383856ed3f
FAPE: 80ef7ae6-c10b-4684-8b2f-79d0bb4d91b5
FAAR: 9c8ccdc7-33e6-452e-baf2-3c911bbf0661

Sodimac Search Prod
SOCL: 0beffe4d-bca3-4339-8ffd-e9ff50437a4a
SOCO: b5351ac7-b1fa-485a-86bf-8e4c13501c6b
SOPE: a9c007da-02be-4d81-b378-622682a1045d
SOAR: 76952c52-9b53-4d2b-84d4-c12518a82b96
SOMX: bb71f4db-7fab-4ff4-8983-d3e3753051e4
SOBR: fb9ddf61-9d5a-4ecf-b76a-d38248c33240
SOUY: 459e48c3-9637-4ec3-8e02-002a995b31af

Core Search Prod
TOCL: d9e55b26-c4bf-45d7-bea9-0857f40cd6ea
TOPE: 21bdfbc6-e3b0-4e57-a22a-2fd18879276b
```

