import axios from 'axios'; async function main() { const url = 'https://search-kyrok9udlk.gapcommerceapi.com/product/search'; const query = { from: 0, size: 500, query: { bool: { must: [ { bool: { filter: { range: { customMinPrice: { gte: 0.01, lte: 500000 }}}}}, { bool: { should: [{ match: { isAboveThreshold: true }}]}}, { bool: { should: [{ match: { isHideFromMenu: false }}]}} ] } } }; console.log('Querying Treez Elasticsearch API...\n'); try { const response = await axios.post(url, query, { headers: { 'Content-Type': 'application/json' } }); const data = response.data; const total = data.hits?.total?.value || data.hits?.total; const products = data.hits?.hits || []; console.log('Total products: ' + total); console.log('Products returned: ' + products.length + '\n'); if (products.length > 0) { const first = products[0]._source; console.log('=== PRODUCT FIELDS AVAILABLE ===\n'); console.log(Object.keys(first).sort().join('\n')); console.log('\n=== SAMPLE PRODUCT ===\n'); console.log(JSON.stringify(first, null, 2)); } } catch (err: any) { console.log('Error: ' + err.message); if (err.response) { console.log('Status: ' + err.response.status); console.log('Data: ' + JSON.stringify(err.response.data)); } } } main();