<?php
$mapping = '{"mappings":{"properties":{"deleted":{"type":"keyword","_bind":{"attributes.*.key":"deleted"}},"handlers":{"type":"keyword","_bind":{"attributes.*.key":"handlers"}},"group_code":{"type":"keyword","_bind":{"attributes.*.key":"group_code"}},"id":{"type":"keyword","_bind":"id"},"created_at":{"type":"keyword","_bind":"created_at"},"updated_at":{"type":"keyword","_bind":"updated_at"},"bd_code":{"type":"keyword","_bind":{"attributes.*.key":"bd_code"}},"bd_name":{"type":"keyword","_bind":{"attributes.*.key":"bd_name"}},"bd_project_id":{"type":"keyword","_bind":{"attributes.*.key":"bd_project_id"}},"bd_comment":{"type":"keyword","_bind":{"attributes.*.key":"bd_comment"}},"creator":{"type":"keyword","_bind":{"attributes.*.key":"creator"}},"bd_status":{"type":"keyword","_bind":{"attributes.*.key":"bd_status"}}}},"settings":{"index":{"number_of_shards":1,"number_of_replicas":1}}}';
$mappings[] = json_decode($mapping, true);
$mapping = '';
$mappings[] = json_decode($mapping, true);
$mapping = '';
$mappings[] = json_decode($mapping, true);
$mapping = '';
$mappings[] = json_decode($mapping, true);
$mapping = '';
$mappings[] = json_decode($mapping, true);
$keys = [];
$mapping = '{"mappings":{"properties":{"statement_of_account_id":{"type":"keyword","_bind":{"attributes.*.key":"statement_of_account_id"}},"order_type":{"type":"keyword","_bind":{"attributes.*.key":"order_type"}},"reviewer":{"type":"keyword","_bind":{"attributes.*.key":"reviewer"}},"audit_time":{"type":"keyword","_bind":{"attributes.*.key":"audit_time"}},"review_opinions":{"type":"keyword","_bind":{"attributes.*.key":"review_opinions"}},"created_at":{"type":"keyword","_bind":{"attributes.*.key":"created_at"}},"updated_at":{"type":"keyword","_bind":{"attributes.*.key":"updated_at"}},"deleted":{"type":"keyword","_bind":{"attributes.*.key":"deleted"}},"id":{"type":"keyword","_bind":"id"}}},"settings":{"index":{"number_of_shards":1,"number_of_replicas":1}}}';
$mappings[] = json_decode($mapping, true);
$keys = [];
foreach($mappings as $mapping) {
foreach($mapping['mappings']['properties'] as $item) {
if (is_array($item['_bind'])) {
$keys[] = $item['_bind']['attributes.*.key'];
} else {
$keys[] =$item['_bind'];
}
}
}
$keys = array_unique($keys);
foreach ($keys as $item)
{
$res[] = [
'key' => $item,
'operation' => 'all',
'type' => 'metadata'
];
}
echo json_encode($res);