-- ES → SparkSQL 直读冒烟（无认证）
-- 跑：python3 bin/spark-sql-starter.py -f tests/integration/tracking/es_read_smoke.sql
-- 前置：集群 spark/jars/ 已挂 elasticsearch-spark-20_2.11-7.17.29.jar（见 kb/01 §5）

CREATE TEMPORARY VIEW v_es_traces
USING org.elasticsearch.spark.sql
OPTIONS (
  'es.nodes' = '192.168.33.21',
  'es.port' = '9200',
  'es.nodes.wan.only' = 'true',
  'es.resource' = 'traces-2026-04-08'
);

SELECT COUNT(*) AS cnt FROM v_es_traces;

SELECT * FROM v_es_traces LIMIT 5;
