# Query: travel-sample # Flags: WordMatch RegExp # Including: ./docs-server # Excluding: *.html,*.json N1QL data definition language pages modules/n1ql/examples/n1ql-language-reference/adaptive-idx-limits-1.jsonc: 9: "cover ((`travel-sample`.`city`))", 10: "cover ((meta(`travel-sample`).`id`))" 19: "keyspace": "travel-sample", 43: "condition": "(cover ((`travel-sample`.`city`)) = \"San Francisco\")" 49: "expr": "cover ((`travel-sample`.`city`))" 61: "text": "SELECT city FROM `travel-sample` USE INDEX (idx_city) WHERE city = \"San Francisco\";" modules/n1ql/examples/n1ql-language-reference/adaptive-idx-limits-2.jsonc: 15: "keyspace": "travel-sample", 35: "keyspace": "travel-sample", 45: "condition": "((`travel-sample`.`city`) = \"San Francisco\")" 51: "expr": "(`travel-sample`.`city`)" 63: "text": "SELECT city FROM `travel-sample` USE INDEX (ai_city) WHERE city = \"San Francisco\";" modules/n1ql/examples/n1ql-language-reference/adaptive-idx-partial-1.jsonc: 16: "keyspace": "travel-sample", 35: "keyspace": "travel-sample", 63: "text": "SELECT META(t).id FROM `travel-sample` t WHERE t.geo.alt > 1000 AND t.type = \"airport\";" modules/n1ql/examples/n1ql-language-reference/adaptive-idx-partial-2.jsonc: 18: "keyspace": "travel-sample", 47: "keyspace": "travel-sample", 76: "keyspace": "travel-sample", 98: "keyspace": "travel-sample", 126: "text": "SELECT META(t).id FROM `travel-sample` t WHERE t.geo.alt > 1000 AND t.type = \"airport\";" modules/n1ql/pages/n1ql-language-reference/adaptive-indexing.adoc: 200: For example, consider the `travel-sample` data that is shipped with the product and the following indexes. 209: CREATE INDEX `idx_airportname` ON `travel-sample`(`airportname`) WHERE type = "airport"; 216: CREATE INDEX `idx_city` ON `travel-sample`(`city`) WHERE type = "airport"; 223: CREATE INDEX `idx_faa` ON `travel-sample`(`faa`) WHERE type = "airport"; 235: SELECT * FROM `travel-sample` WHERE airportname LIKE "San Francisco%" AND type = "airport"; 242: SELECT * FROM `travel-sample` WHERE city = "San Francisco" AND type = "airport"; 249: SELECT * FROM `travel-sample` WHERE faa = "SFO" AND type = "airport"; 261: ON `travel-sample`(DISTINCT PAIRS({airportname, city, faa, type})) 271: SELECT * FROM `travel-sample` 280: SELECT * FROM `travel-sample` 289: SELECT * FROM `travel-sample` 296: In fact, an adaptive index that includes all fields in the documents can serve any query on the `travel-sample` keyspace, though it might have different performance characteristics when compared to specific indexes created for a particular query. 306: ON `travel-sample`(DISTINCT PAIRS(self)) 314: EXPLAIN SELECT * FROM `travel-sample` 338: "keyspace": "travel-sample", 362: FROM `travel-sample` 387: "keyspace": "travel-sample", 419: ON `travel-sample`(city, faa, airportname) 435: SELECT * FROM `travel-sample` 452: CREATE INDEX idx_name ON `travel-sample`(field1, field2, ..., field9); 477: CREATE INDEX ai_geo ON `travel-sample`(DISTINCT PAIRS({geo.alt, geo.lat, geo.lon})) WHERE type = "airport"; -- <1> 484: EXPLAIN SELECT META(t).id FROM `travel-sample` t WHERE t.geo.alt > 1000 AND t.type = "airport"; 505: CREATE INDEX ai_geo_type ON `travel-sample`(DISTINCT PAIRS({geo.alt, geo.lat, geo.lon, type})) WHERE type = "airport"; -- <1> 535: CREATE INDEX idx_name ON `travel-sample`(name); -- <1> 536: CREATE INDEX idx_self ON `travel-sample`(DISTINCT PAIRS(self)); -- <2> 537: EXPLAIN SELECT * FROM `travel-sample` WHERE name IS NOT NULL; 563: CREATE INDEX idx_adpt ON `travel-sample`(DISTINCT PAIRS(self)) WHERE city="Paris"; 564: CREATE INDEX idx_reg1 ON `travel-sample`(name) WHERE city="Paris"; 565: CREATE INDEX idx_reg2 ON `travel-sample`(city); 567: SELECT * FROM `travel-sample` WHERE city="Paris" AND name IS NOT NULL; 588: This example uses the `def_city` index, which is installed with the `travel-sample` bucket. 594: CREATE INDEX `def_city` ON `travel-sample`(`city`); 601: EXPLAIN SELECT city FROM `travel-sample` USE INDEX (def_city) WHERE city = "San Francisco"; 617: CREATE INDEX `ai_city` ON `travel-sample`(DISTINCT PAIRS({city})); 624: EXPLAIN SELECT city FROM `travel-sample` USE INDEX (ai_city) WHERE city = "San Francisco"; 642: .. For example, the following queries show that a single route document in `travel-sample` generates 103 index items and that all route documents produce ~2.3 million items. 647: SELECT array_length(PAIRS(self)) FROM `travel-sample` 663: SELECT sum(array_length(PAIRS(self))) FROM `travel-sample` 699: CREATE INDEX `ai_city1` ON `travel-sample`(DISTINCT PAIRS({"city" : LOWER(city)})); 704: EXPLAIN SELECT city FROM `travel-sample` 719: "cover ((`travel-sample`.`city`))", 720: "cover ((meta(`travel-sample`).`id`))" 737: EXPLAIN SELECT city FROM `travel-sample` 752: "cover ((`travel-sample`.`city`))", 753: "cover ((meta(`travel-sample`).`id`))" 762: EXPLAIN SELECT city FROM `travel-sample` 793: CREATE INDEX `ai_city2` ON `travel-sample`(DISTINCT PAIRS({"city" : city})); 798: EXPLAIN SELECT city FROM `travel-sample` 812: "cover ((`travel-sample`.`city`))", 813: "cover ((meta(`travel-sample`).`id`))" modules/n1ql/pages/n1ql-language-reference/alterindex.adoc: 32: CREATE INDEX idx1 ON `travel-sample`(id, airline) WHERE type="route"; 34: ALTER INDEX `travel-sample`.idx1 113: For example, `default:{backtick}travel-sample{backtick}.places.cities.{backtick}idx-name{backtick}` indicates the `idx-name` index on the `cities` collection in the `places` scope in the `default:{backtick}travel-sample{backtick}` bucket. 138: For example, `default:{backtick}travel-sample{backtick}.def_type` indicates the `def_type` index on the default collection in the default scope in the `default:{backtick}travel-sample{backtick}` bucket. 210: For example, `def_type ON default:{backtick}travel-sample{backtick}` indicates the `def_type` index on the default collection in the default scope in the `default:{backtick}travel-sample{backtick}` bucket. 212: Similarly, `{backtick}idx-name{backtick} ON default:{backtick}travel-sample{backtick}.places.cities` indicates the `idx-name` index on the `cities` collection in the `places` scope in the `default:{backtick}travel-sample{backtick}` bucket. 385: Create a cluster of 3 nodes and then go to menu:Settings[Sample buckets] to install the `travel-sample` bucket. 393: ALTER INDEX `travel-sample`.def_faa 415: CREATE INDEX country_idx ON `travel-sample`(country, city) 419: ALTER INDEX `travel-sample`.country_idx 430: CREATE INDEX country_idx ON `travel-sample`(country, city) 433: ALTER INDEX `travel-sample`.country_idx 445: CREATE INDEX country_idx ON `travel-sample`(country, city) 448: ALTER INDEX `travel-sample`.country_idx 459: CREATE INDEX country_idx ON `travel-sample`(country, city) 462: ALTER INDEX `travel-sample`.country_idx 473: CREATE INDEX country_idx ON `travel-sample`(country, city) 476: ALTER INDEX `travel-sample`.country_idx 488: CREATE INDEX country_idx ON `travel-sample`(country, city) 492: ALTER INDEX `travel-sample`.country_idx WITH {"action": "drop_replica", "replicaId": 2}; modules/n1ql/pages/n1ql-language-reference/build-index.adoc: 113: BUILD INDEX ON `travel-sample`(ix1, ix2, ix3); 125: BUILD INDEX ON `travel-sample`('ix1', 'ix2', 'ix3'); 126: BUILD INDEX ON `travel-sample`(['ix1', 'ix2', 'ix3']); 127: BUILD INDEX ON `travel-sample`('ix1', ['ix2', 'ix3'], ['ix4']); 137: BUILD INDEX ON `travel-sample`([ix1, ix2, ix3]); 138: BUILD INDEX ON `travel-sample`([ix1], [ix2, ix3]); 177: Create a set of primary and secondary indexes on the `travel-sample` bucket with the `defer_build` option. modules/n1ql/pages/n1ql-language-reference/covering-indexes.adoc: 21: NOTE: The examples on this page use the `travel-sample` and `default` keyspaces and need to be enabled before using them. 26: Consider a simple index, [.in]`idx_state`, on the attribute [.param]`state` in the `travel-sample` keyspace: 29: CREATE INDEX idx_state on `travel-sample` (state,type) USING GSI; 32: If we select [.param]`state` from the `pass:c[`travel-sample`]` keyspace, the actual values of the field [.param]`state` that are to be returned are present in the index [.param]`idx_state`, and avoids an additional step to fetch the data. 36: EXPLAIN SELECT state FROM `travel-sample` WHERE type="hotel" AND state = "CA"; 47: "cover ((`travel-sample`.`state`))", 48: "cover ((`travel-sample`.`type`))", 49: "cover ((meta(`travel-sample`).`id`))" 59: "keyspace": "travel-sample", 87: "condition": "((cover ((`travel-sample`.`type`)) = \"hotel\") and (cover ((`travel-sample`.`state`)) = \"CA\"))" 93: "expr": "cover ((`travel-sample`.`state`))" / using Covered Index 105: "text": "SELECT state FROM `travel-sample` WHERE type=\"hotel\" AND state = \"CA\";" 110: If you modify the query to select the [.param]`state` and [.param]`city` from the `pass:c[`travel-sample`]` keyspace using the same index [.param]`idx_state`, the index does not contain the values of the [.param]`city` field to satisfy the query, and hence a key-value fetch is performed to retrieve this data. 113: EXPLAIN SELECT state,city FROM `travel-sample` USE INDEX (idx_state) WHERE type="hotel" AND state = "CA"; 130: "keyspace": "travel-sample", 153: "keyspace": "travel-sample", 163: "condition": "(((`travel-sample`.`type`) = \"hotel\") and ((`travel-sample`.`state`) = \"CA\"))" 169: "expr": "(`travel-sample`.`state`)" / not using Covered Index 172: "expr": "(`travel-sample`.`city`)" 184: "text": "SELECT state,city FROM `travel-sample` WHERE type=\"hotel\" AND state = \"CA\";" 192: CREATE INDEX idx_state_city on `travel-sample` (state, type, city) USING GSI; 222: EXPLAIN SELECT MAX(country) FROM `travel-sample` WHERE city = "Paris"; 226: EXPLAIN SELECT country || city FROM `travel-sample` USE INDEX (idx_country_city) WHERE city = "Paris"; 232: SELECT country FROM `travel-sample` WHERE city = "Paris" 234: SELECT country FROM `travel-sample` WHERE city = "San Francisco"; 242: SELECT country FROM `travel-sample` WHERE city = "Paris" 244: SELECT country FROM `travel-sample` WHERE city = "San Francisco" 251: INSERT INTO `travel-sample`(KEY k, VALUE city) 252: SELECT country, city FROM `travel-sample` WHERE city = "Paris"; 260: CREATE INDEX idx_array ON `travel-sample`(a, b); 266: SELECT b FROM `travel-sample` WHERE a = [1, 2, 3, 4]; Update example scope and collection names ("modes" and "train") modules/n1ql/pages/n1ql-language-reference/createindex.adoc: 130: For example, `default:{backtick}travel-sample{backtick}` indicates the default collection in the default scope in the `travel-sample` bucket in the `default` namespace. 132: Similarly, `default:{backtick}travel-sample{backtick}.places.cities` indicates the `cities` collection in the `places` scope in the `travel-sample` bucket in the `default` namespace. 322: CREATE INDEX alt_idx ON `travel-sample`(geo.alt); 329: SELECT MIN(geo.alt), MAX(geo.alt) FROM `travel-sample`; 356: This example creates an index on the default collection in the default scope within the `travel-sample` bucket. 365: CREATE INDEX idx_default_over1000 ON `travel-sample`(geo.alt) WHERE geo.alt > 1000 USING GSI WITH {"nodes": ["127.0.0.1:8091"]}; 373: First set the {query-context}[query context] to `{backtick}travel-sample{backtick}.inventory`. 375: image::tools:query-workbench-context.png["\SET -query_context 'travel-sample.inventory';"] modules/n1ql/pages/n1ql-language-reference/createprimaryindex.adoc: 116: For example, `default:{backtick}travel-sample{backtick}` indicates the default collection in the default scope in the `travel-sample` bucket in the `default` namespace. 118: Similarly, `default:{backtick}travel-sample{backtick}.places.cities` indicates the `cities` collection in the `places` scope in the `travel-sample` bucket in the `default` namespace. 248: This example creates a primary index on the default collection in the default scope within the `travel-sample` bucket. 253: Create a named primary index on the `travel-sample` keyspace. 257: CREATE PRIMARY INDEX idx_default_primary ON `travel-sample` USING GSI; 265: First set the {query-context}[query context] to `{backtick}travel-sample{backtick}.inventory`. 267: image::tools:query-workbench-context.png["\SET -query_context 'travel-sample.inventory';"] 285: CREATE PRIMARY INDEX idx_hotel_primary ON `travel -sample`.inventory.hotel USING GSI 305: BUILD INDEX ON `travel-sample`.inventory.hotel(idx_hotel_primary) USING GSI; Update example scope and collection names ("modes" and "train") modules/n1ql/pages/n1ql-language-reference/dropindex.adoc: 76: For example, `default:{backtick}travel-sample{backtick}.places.cities.{backtick}idx-name{backtick}` indicates the `idx-name` index on the `cities` collection in the `places` scope in the `default:{backtick}travel-sample{backtick}` bucket. 101: For example, `default:{backtick}travel-sample{backtick}.def_type` indicates the `def_type` index on the default collection in the default scope in the `default:{backtick}travel-sample{backtick}` bucket. 173: For example, `def_type ON default:{backtick}travel-sample{backtick}` indicates the `def_type` index on the default collection in the default scope in the `default:{backtick}travel-sample{backtick}` bucket. 175: Similarly, `{backtick}idx-name{backtick} ON default:{backtick}travel-sample{backtick}.places.cities` indicates the `idx-name` index on the `cities` collection in the `places` scope in the `default:{backtick}travel-sample{backtick}` bucket. 228: This example creates a secondary index on the default collection in the default scope in the travel-sample bucket. 234: CREATE INDEX `idx-callsign` ON `travel-sample`(callsign) USING GSI; 243: DROP INDEX `travel-sample`.`idx-callsign` USING GSI; 252: DROP INDEX `idx-callsign` ON `travel-sample` USING GSI; 259: This statement drops an index called `idx-name` from the `countries` collection within the `places` scope in the `travel-sample` bucket. 267: cbq> \SET -query_context "travel-sample.places"; 289: This statement drops an index called `idx-name` from the `countries` collection within the `places` scope in the `travel-sample` bucket. 295: DROP INDEX `idx-name` ON `travel-sample`.places.countries; modules/n1ql/pages/n1ql-language-reference/dropprimaryindex.adoc: 75: For example, `default:{backtick}travel-sample{backtick}` indicates the default collection in the default scope in the `travel-sample` bucket in the `default` namespace. 77: Similarly, `default:{backtick}travel-sample{backtick}.places.cities` indicates the `cities` collection in the `places` scope in the `travel-sample` bucket in the `default` namespace. 117: Create an unnamed primary index on the `travel-sample` keyspace. 122: CREATE PRIMARY INDEX ON `travel-sample` USING GSI; 130: DROP PRIMARY INDEX ON `travel-sample` USING GSI; modules/n1ql/pages/n1ql-language-reference/index-partitioning.adoc: 203: For example, in the `travel-sample` keyspace, the field named `type` almost never changes, and is therefore a good candidate for partition key. 220: CREATE INDEX idx ON `travel-sample`(country, airline, id) 228: CREATE INDEX idx ON `travel-sample`(sourceairport,destinationairport, stops, airline, id) 236: CREATE INDEX idx ON `travel-sample`(airline, sourceairport, destinationairport, stops, id) 244: CREATE INDEX idx ON `travel-sample` (sourceairport, stops, airline, id) 252: CREATE INDEX idx ON `travel-sample`(LOWER(sourceairport), LOWER(destinationairport), stops, airline, id) 260: CREATE INDEX idx ON `travel-sample`(POSITION(meta().id,'__')+2, destinationairport, sourceairport, stops, airline, id) 285: CREATE INDEX idx_pe1 ON `travel-sample`(country, airline, id) 289: FROM `travel-sample` 312: CREATE INDEX idx_pe2 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id) 316: FROM `travel-sample` 334: CREATE INDEX idx_pe3 ON `travel-sample` (airline, sourceairport, destinationairport, stops, id) 338: FROM `travel-sample` 355: CREATE INDEX idx_pe4 ON `travel-sample` (LOWER(sourceairport), LOWER(destinationairport), stops, airline, id) 359: FROM `travel-sample` 376: CREATE INDEX idx_pe5 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id) 380: FROM `travel-sample` 398: CREATE INDEX idx_pe6 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id) 402: FROM `travel-sample` 417: CREATE INDEX idx_pe7 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id) 421: FROM `travel-sample` 438: CREATE INDEX idx_pe8 ON `travel-sample` (sourceairport, stops, airline, id) 442: FROM `travel-sample` 455: CREATE INDEX idx ON `travel-sample`(airline, destinationairport, sourceairport) 476: CREATE INDEX idx_pe9 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id, ARRAY_COUNT(schedule)) 480: FROM `travel-sample` 502: CREATE INDEX idx_pe10 ON `travel-sample` (sourceairport, destinationairport, stops, airline, id, ARRAY_COUNT(schedule)) 506: FROM `travel-sample` 523: CREATE INDEX idx_pe11 ON `travel-sample`(airline, sourceairport, destinationairport) 541: CREATE INDEX idx_pe12 ON `travel-sample`(airline, sourceairport, destinationairport) 591: CREATE INDEX idx_pe13 ON `travel-sample`(airline, sourceairport, destinationairport) 600: CREATE INDEX idx_pe14 ON `travel-sample`(airline, sourceairport, schedule) 617: CREATE INDEX idx_pe15 ON `travel-sample`(airline, sourceairport, schedule) modules/n1ql/pages/n1ql-language-reference/groupby-aggregate-performance.adoc: 36: current performance of using GROUP BY and examine the EXPLAIN plan of the following query that is defined in the Couchbase `travel-sample` index: 40: CREATE INDEX `def_type` ON `travel-sample`(`type`) 48: FROM `travel-sample` 70: FROM `travel-sample` 98: "expr": "cover ((`travel-sample`.`type`))", 130: CREATE INDEX idx_a ON `travel-sample` (geo.alt, geo.lat, geo.lon, id) WHERE type = "airport" 137: * `pass:c[SELECT COUNT(*) FROM `travel-sample` WHERE geo.alt > 10 AND type="airport";]` 138: * `pass:c[SELECT COUNT(geo.alt) FROM `travel-sample` WHERE geo.alt BETWEEN 10 AND 30 AND type = "airport";]` 139: * `pass:c[SELECT COUNT(geo.lat) FROM `travel-sample` WHERE geo.alt BETWEEN 10 AND 30 AND geo.lat = 40 AND type = "airport";]` 140: * `pass:c[SELECT geo.alt, AVG(id), SUM(id), COUNT(geo.alt), MIN (geo.lon), MAX(ABS(geo.lon)) FROM `travel-sample` WHERE geo.alt > 100 AND type = "airport" GROUP BY geo.alt;]` 141: * `pass:c[SELECT lat_count, SUM(id) FROM `travel-sample` WHERE geo.alt > 100 AND type = "airport" GROUP BY geo.alt LETTING lat_count = COUNT(geo.lat) HAVING lat_count > 1;]` 142: * `pass:c[SELECT AVG(DISTINCT geo.lat) FROM `travel-sample` WHERE geo.alt > 100 AND type = "airport" GROUP BY geo.alt;]` 146: * `pass:c[SELECT COUNT(*) FROM `travel-sample` WHERE geo.lat > 20 AND type = "airport";]` 152: * `pass:c[SELECT COUNT(*) FROM `travel-sample`;]` 157: * `pass:c[SELECT COUNT(v1) FROM `travel-sample` LET v1 = ROUND(geo.lat) WHERE geo.lat > 10 AND type = "airport";]` 162: * `pass:c[SELECT ARRAY_AGG(geo.alt) FROM `travel-sample` WHERE geo.alt > 10 AND type = "airport";]` 174: CREATE INDEX idx_b ON `travel-sample`(geo.alt, geo.lat, geo.lon, id) 183: FROM `travel-sample` 201: CREATE INDEX idx_c ON `travel-sample`(geo.alt, geo.lat, geo.lon, id) 205: FROM `travel-sample` 225: CREATE INDEX idx_d ON `travel-sample` (geo.lat, geo.lon, DISTINCT public_likes, id) WHERE type = "hotel" 228: FROM `travel-sample` 249: FROM `travel-sample` 264: CREATE INDEX idx_e ON `travel-sample` (ALL public_likes, geo.lat, geo.lon, id) WHERE type = "hotel" 267: FROM `travel-sample` AS t 275: Note, the unwound operation repeats the parent document (`travel-sample`) and the `t.geo.lat` reference would have duplicates compared to the original `travel-sample` documents. 298: We use the `travel-sample` dataset to illustrate both positive and negative use cases. 356: CREATE INDEX idx1 ON `travel-sample`(country, state, geo.lat) 364: FROM `travel-sample` 409: "cover ((`travel-sample`.`country`))", 410: "cover ((`travel-sample`.`state`))", 411: "cover (((`travel-sample`.`geo`).`lat`))", 412: "cover ((meta(`travel-sample`).`id`))", 413: "cover (count(cover ((`travel-sample`.`country`))))", 414: "cover (min(round(cover (((`travel-sample`.`geo`).`lat`)))))" 417: "cover ((`travel-sample`.`type`))": "landmark" 427: "expr": "round(cover (((`travel-sample`.`geo`).`lat`)))", 442: "expr": "cover ((`travel-sample`.`country`))", 450: "expr": "cover ((`travel-sample`.`state`))", 506: CREATE INDEX idx2 ON `travel-sample`(country, state, ROUND(geo.lat)) 514: FROM `travel-sample` 534: "cover ((`travel-sample`.`country`))", 535: "cover ((`travel-sample`.`state`))", 536: "cover (((`travel-sample`.`geo`).`lat`))", 537: "cover ((meta(`travel-sample`).`id`))", 538: "cover (count(cover ((`travel-sample`.`country`))))", 539: "cover (min(round(cover (((`travel-sample`.`geo`).`lat`)))))" 542: "cover ((`travel-sample`.`type`))": "landmark" 552: "expr": "cover ((`travel-sample`.`country`))", 561: "expr": "round(cover (((`travel-sample`.`geo`).`lat`)))", 576: "expr": "cover ((`travel-sample`.`state`))", 623: FROM `travel-sample` 678: CREATE INDEX idx3 ON `travel-sample`(activity, city, geo.lon) 686: FROM `travel-sample` 773: ON `travel-sample`(ROUND(distance*stops), ROUND(distance), sourceairport) 783: FROM `travel-sample` 800: "expr": "cover ((`travel-sample`.`sourceairport`))", 809: "expr": "cover (round((`travel-sample`.`distance`)))", 824: "expr": "cover (round(((`travel-sample`.`distance`) * (`travel-sample`.`stops`))))", 867: ON `travel-sample`(sourceairport, ROUND(distance*stops), distance) 877: FROM `travel-sample` 921: INSERT INTO `travel-sample` VALUES("01",{"type":1, "email":"abc","xx":3}); 922: INSERT INTO `travel-sample` VALUES("01",{"type":1, "email":"abc","xx":null}); 923: INSERT INTO `travel-sample` VALUES("02",{"type":1, "email":"abcd"}); 930: FROM `travel-sample` 987: CREATE PRIMARY INDEX idx6 ON `travel-sample`; 994: FROM `travel-sample` 1040: CREATE INDEX idx7 ON `travel-sample` (city, name) 1048: FROM `travel-sample` 1068: "cover ((`travel-sample`.`city`))", 1069: "cover ((`travel-sample`.`name`))", 1070: "cover ((meta(`travel-sample`).`id`))", 1071: "cover (count(distinct cover ((`travel-sample`.`name`))))" 1074: "cover ((`travel-sample`.`type`))": "landmark" 1085: "expr": "cover ((`travel-sample`.`name`))", 1099: "expr": "cover ((`travel-sample`.`city`))", 1112: "keyspace": "travel-sample", 1166: CREATE INDEX idx8 ON `travel-sample` (city, name) 1174: FROM `travel-sample` 1194: "cover ((`travel-sample`.`city`))", 1195: "cover ((`travel-sample`.`name`))", 1196: "cover ((meta(`travel-sample`).`id`))", 1197: "cover (count(distinct cover ((`travel-sample`.`name`))))" 1200: "cover ((`travel-sample`.`type`))": "landmark" 1211: "expr": "cover ((`travel-sample`.`name`))", 1225: "expr": "cover ((`travel-sample`.`city`))", 1238: "keyspace": "travel-sample", 1322: ON `travel-sample`(ROUND(distance), stops, sourceairport) 1332: FROM `travel-sample` 1357: FROM `travel-sample`; 1380: FROM `travel-sample` 1406: FROM `travel-sample` 1447: CREATE INDEX idx10 ON `travel-sample`(country, state, ABS(ROUND(geo.lat))) 1455: FROM `travel-sample` 1475: "cover ((`travel-sample`.`country`))", 1476: "cover ((`travel-sample`.`state`))", 1477: "cover (abs(round(((`travel-sample`.`geo`).`lat`))))", 1478: "cover ((meta(`travel-sample`).`id`))", 1479: "cover (sum(cover (abs(round(((`travel-sample`.`geo`).`lat`))))))" 1482: "cover ((`travel-sample`.`type`))": "landmark" 1492: "expr": "cover (abs(round(((`travel-sample`.`geo`).`lat`))))", 1507: "expr": "cover ((`travel-sample`.`country`))", 1515: "expr": "cover ((`travel-sample`.`state`))", 1573: CREATE INDEX idx11 ON `travel-sample`(ROUND(geo.lat), geo.alt, city, ROUND(geo.lon)) 1584: FROM `travel-sample` 1662: CREATE INDEX idx12_1 ON `travel-sample`(ROUND(geo.lat), ROUND(geo.lon), country) 1670: FROM `travel-sample` 1701: FROM `travel-sample` 1760: CREATE INDEX idx12_2 ON `travel-sample`(country, ROUND(geo.lat), ROUND(geo.lon)) 1769: FROM `travel-sample` 1804: FROM `travel-sample` 1855: CREATE INDEX idx12_3 ON `travel-sample`(country, geo.lat, geo.lon) 1865: FROM `travel-sample` 1938: CREATE INDEX idx12_4 ON `travel-sample`(geo.alt, geo.lat, geo.lon) 1946: FROM `travel-sample` 1971: FROM `travel-sample` 1995: FROM `travel-sample` 2035: CREATE INDEX idx13 ON `travel-sample` (city, name) 2043: FROM `travel-sample` 2099: CREATE INDEX idx14 ON `travel-sample` (city, name) 2107: FROM `travel-sample` 2188: FROM `travel-sample` 2221: | `pass:c["cover ((`travel-sample`.`type`))"]` 2256: | `pass:c["cover ((`travel-sample`.`type`))"]` 2282: "cover ((`travel-sample`.`name`))", 2283: "cover ((meta(`travel-sample`).`id`))", 2304: "expr": "cover ((`travel-sample`.`name`))", 2317: "keyspace": "travel-sample", 2341: "expr": "cover ((`travel-sample`.`name`))" 2356: "text": "select name, count(1)\nfrom `travel-sample` use index (idx_name)\nwhere name is not missing\ngroup by name;" 2384: | `pass:c[round(cover (((`travel-sample`. 2418: | `pass:c[`travel-sample`.`country`]` 2459: | `pass:c["abs(round(cover (((`travel-sample`.`geo`).`lat`))))"]` 2492: | `pass:c["cover ((`travel-sample`.`state`))"]` 2516: | `pass:c["cover ((`travel-sample`.`state`))"]` modules/n1ql/pages/n1ql-language-reference/indexing-arrays.adoc: 269: The following examples use the {install-sample-buckets}[travel-sample] keyspace that is shipped with Couchbase Server. 279: ON `travel-sample` ( DISTINCT ARRAY v.flight FOR v IN schedule END ); 286: SELECT * FROM `travel-sample` 298: ON `travel-sample` ( ALL ARRAY v.flight FOR v IN schedule WHEN v.day < 4 END ) 306: SELECT * FROM `travel-sample` 326: ON `travel-sample` 335: SELECT * FROM `travel-sample` 349: UPDATE `travel-sample` 362: CREATE INDEX idx_nested ON `travel-sample` 376: SELECT count(*) FROM `travel-sample` 387: SELECT count(*) FROM `travel-sample` 401: CREATE INDEX idx_flight_day ON `travel-sample` 410: SELECT meta().id FROM `travel-sample` 423: ON `travel-sample` (ALL schedule) 431: SELECT * FROM `travel-sample` 443: SELECT * FROM `travel-sample` t 468: CREATE INDEX idx_sched_covered ON `travel-sample` 483: EXPLAIN SELECT meta().id FROM `travel-sample` 504: "cover ((distinct (array (`v`.`flight`) for `v` in (`travel-sample`.`schedule`) end)))", 505: "cover ((`travel-sample`.`schedule`))", 506: "cover ((meta(`travel-sample`).`id`))" 509: "cover ((`travel-sample`.`type`))": "route", 510: "cover (any `v` in (`travel-sample`.`schedule`) satisfies ((\"UA\" <= (`v`.`flight`)) and ((`v`.`flight`) < \"UB\")) end)": true, 511: "cover (any `v` in (`travel-sample`.`schedule`) satisfies ((`v`.`flight`) like \"UA%\") end)": true 521: EXPLAIN SELECT meta().id FROM `travel-sample` 540: "cover ((distinct (array (`v`.`flight`) for `v` in (`travel-sample`.`schedule`) end)))", 541: "cover ((`travel-sample`.`schedule`))", 542: "cover ((meta(`travel-sample`).`id`))" 545: "cover ((`travel-sample`.`type`))": "route" 555: EXPLAIN SELECT meta(t).id FROM `travel-sample` t 600: CREATE INDEX idx_sched_covered_all ON `travel-sample` 609: EXPLAIN SELECT meta().id FROM `travel-sample` 647: CREATE INDEX idx_sched_covered_simple ON `travel-sample` 656: EXPLAIN SELECT meta().id FROM `travel-sample` 675: "cover ((distinct (array (`v`.`flight`) for `v` in (`travel-sample`.`schedule`) end)))", 676: "cover ((meta(`travel-sample`).`id`))" 679: "cover ((`travel-sample`.`type`))": "route", 680: "cover (any `v` in (`travel-sample`.`schedule`) satisfies ((\"UA\" <= (`v`.`flight`)) and ((`v`.`flight`) < \"UB\")) end)": true, 681: "cover (any `v` in (`travel-sample`.`schedule`) satisfies ((`v`.`flight`) like \"UA%\") end)": true 699: CREATE INDEX idx_sched_covered_simple_all ON `travel-sample` 708: EXPLAIN SELECT meta(t).id FROM `travel-sample` t 738: "keyspace": "travel-sample", 761: EXPLAIN SELECT meta(t).id FROM `travel-sample` t 786: "keyspace": "travel-sample", modules/n1ql/pages/n1ql-language-reference/indexing-meta-info.adoc: 34: CREATE INDEX idx_expir ON `travel-sample` ( META().expiration ); 41: FROM `travel-sample` 68: CREATE INDEX idx_id ON `travel-sample` (META().id ); 75: FROM `travel-sample` 101: CREATE INDEX idx_cas ON `travel-sample` ( META().cas ); 108: FROM `travel-sample`