blob: 794aed0431be613c777bf75445c1bb8dbe64ce72 [file] [log] [blame]
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=i,h=m["".concat(l,".").concat(u)]||m[u]||c[u]||r;return n?a.createElement(h,o(o({ref:t},d),{},{components:n})):a.createElement(h,o({ref:t},d))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[m]="string"==typeof e?e:i,o[1]=s;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},93568:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=["components"],s={id:"ingestion-spec",title:"Ingestion spec reference",sidebar_label:"Ingestion spec reference",description:"Reference for the configuration options in the ingestion spec."},l=void 0,p={unversionedId:"ingestion/ingestion-spec",id:"ingestion/ingestion-spec",title:"Ingestion spec reference",description:"Reference for the configuration options in the ingestion spec.",source:"@site/docs/28.0.1/ingestion/ingestion-spec.md",sourceDirName:"ingestion",slug:"/ingestion/ingestion-spec",permalink:"/docs/28.0.1/ingestion/ingestion-spec",draft:!1,tags:[],version:"current",frontMatter:{id:"ingestion-spec",title:"Ingestion spec reference",sidebar_label:"Ingestion spec reference",description:"Reference for the configuration options in the ingestion spec."},sidebar:"docs",previous:{title:"Hadoop-based",permalink:"/docs/28.0.1/ingestion/hadoop"},next:{title:"Schema design tips",permalink:"/docs/28.0.1/ingestion/schema-design"}},d={},m=[{value:"<code>dataSchema</code>",id:"dataschema",level:2},{value:"<code>dataSource</code>",id:"datasource",level:3},{value:"<code>timestampSpec</code>",id:"timestampspec",level:3},{value:"<code>dimensionsSpec</code>",id:"dimensionsspec",level:3},{value:"Dimension objects",id:"dimension-objects",level:4},{value:"Inclusions and exclusions",id:"inclusions-and-exclusions",level:4},{value:"<code>metricsSpec</code>",id:"metricsspec",level:3},{value:"<code>granularitySpec</code>",id:"granularityspec",level:3},{value:"<code>transformSpec</code>",id:"transformspec",level:3},{value:"Transforms",id:"transforms",level:4},{value:"Filter",id:"filter",level:4},{value:"Legacy <code>dataSchema</code> spec",id:"legacy-dataschema-spec",level:3},{value:"<code>parser</code> (Deprecated)",id:"parser-deprecated",level:4},{value:"<code>flattenSpec</code>",id:"flattenspec",level:4},{value:"<code>ioConfig</code>",id:"ioconfig",level:2},{value:"<code>tuningConfig</code>",id:"tuningconfig",level:2},{value:"<code>indexSpec</code>",id:"indexspec",level:3},{value:"Front coding",id:"front-coding",level:5}],c={toc:m},u="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,o);return(0,r.kt)(u,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"All ingestion methods use ingestion tasks to load data into Druid. Streaming ingestion uses ongoing supervisors that run and supervise a set of tasks over time. Native batch and Hadoop-based ingestion use a one-time ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/tasks"},"task"),". Other than with SQL-based ingestion, use an ",(0,r.kt)("em",{parentName:"p"},"ingestion spec")," to configure your ingestion."),(0,r.kt)("p",null,"Ingestion specs consists of three main components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#dataschema"},(0,r.kt)("inlineCode",{parentName:"a"},"dataSchema")),", which configures the ",(0,r.kt)("a",{parentName:"li",href:"#datasource"},"datasource name"),",\n",(0,r.kt)("a",{parentName:"li",href:"#timestampspec"},"primary timestamp"),", ",(0,r.kt)("a",{parentName:"li",href:"#dimensionsspec"},"dimensions"),", ",(0,r.kt)("a",{parentName:"li",href:"#metricsspec"},"metrics"),", and ",(0,r.kt)("a",{parentName:"li",href:"#transformspec"},"transforms and filters")," (if needed)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#ioconfig"},(0,r.kt)("inlineCode",{parentName:"a"},"ioConfig")),", which tells Druid how to connect to the source system and how to parse data. For more information, see the\ndocumentation for each ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#tuningconfig"},(0,r.kt)("inlineCode",{parentName:"a"},"tuningConfig")),", which controls various tuning parameters specific to each\n",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method"),".")),(0,r.kt)("p",null,"Example ingestion spec for task type ",(0,r.kt)("inlineCode",{parentName:"p"},"index_parallel")," (native batch):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "type": "index_parallel",\n "spec": {\n "dataSchema": {\n "dataSource": "wikipedia",\n "timestampSpec": {\n "column": "timestamp",\n "format": "auto"\n },\n "dimensionsSpec": {\n "dimensions": [\n "page",\n "language",\n { "type": "long", "name": "userId" }\n ]\n },\n "metricsSpec": [\n { "type": "count", "name": "count" },\n { "type": "doubleSum", "name": "bytes_added_sum", "fieldName": "bytes_added" },\n { "type": "doubleSum", "name": "bytes_deleted_sum", "fieldName": "bytes_deleted" }\n ],\n "granularitySpec": {\n "segmentGranularity": "day",\n "queryGranularity": "none",\n "intervals": [\n "2013-08-31/2013-09-01"\n ]\n }\n },\n "ioConfig": {\n "type": "index_parallel",\n "inputSource": {\n "type": "local",\n "baseDir": "examples/indexing/",\n "filter": "wikipedia_data.json"\n },\n "inputFormat": {\n "type": "json",\n "flattenSpec": {\n "useFieldDiscovery": true,\n "fields": [\n { "type": "path", "name": "userId", "expr": "$.user.id" }\n ]\n }\n }\n },\n "tuningConfig": {\n "type": "index_parallel"\n }\n }\n}\n')),(0,r.kt)("p",null,"The specific options supported by these sections will depend on the ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method")," you have chosen.\nFor more examples, refer to the documentation for each ingestion method."),(0,r.kt)("p",null,'You can also load data visually, without the need to write an ingestion spec, using the "Load data" functionality\navailable in Druid\'s ',(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/operations/web-console"},"web console"),". Druid's visual data loader supports\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/development/extensions-core/kafka-ingestion"},"Kafka"),",\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/development/extensions-core/kinesis-ingestion"},"Kinesis"),", and\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/native-batch"},"native batch")," mode."),(0,r.kt)("h2",{id:"dataschema"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataSchema")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," The ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," spec has been changed in 0.17.0. The new spec is supported by all ingestion methods\nexcept for ",(0,r.kt)("em",{parentName:"p"},"Hadoop")," ingestion. See the ",(0,r.kt)("a",{parentName:"p",href:"#legacy-dataschema-spec"},"Legacy ",(0,r.kt)("inlineCode",{parentName:"a"},"dataSchema")," spec")," for the old spec.")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," is a holder for the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#datasource"},"datasource name")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#timestampspec"},"primary timestamp")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#dimensionsspec"},"dimensions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#metricsspec"},"metrics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#transformspec"},"transforms and filters")," (if needed).")),(0,r.kt)("p",null,"An example ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"dataSchema": {\n "dataSource": "wikipedia",\n "timestampSpec": {\n "column": "timestamp",\n "format": "auto"\n },\n "dimensionsSpec": {\n "dimensions": [\n "page",\n "language",\n { "type": "long", "name": "userId" }\n ]\n },\n "metricsSpec": [\n { "type": "count", "name": "count" },\n { "type": "doubleSum", "name": "bytes_added_sum", "fieldName": "bytes_added" },\n { "type": "doubleSum", "name": "bytes_deleted_sum", "fieldName": "bytes_deleted" }\n ],\n "granularitySpec": {\n "segmentGranularity": "day",\n "queryGranularity": "none",\n "intervals": [\n "2013-08-31/2013-09-01"\n ]\n }\n}\n')),(0,r.kt)("h3",{id:"datasource"},(0,r.kt)("inlineCode",{parentName:"h3"},"dataSource")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSource")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSource")," and is simply the name of the\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/design/architecture#datasources-and-segments"},"datasource")," that data will be written to. An example\n",(0,r.kt)("inlineCode",{parentName:"p"},"dataSource")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"dataSource": "my-first-datasource"\n')),(0,r.kt)("h3",{id:"timestampspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"timestampSpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"timestampSpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"timestampSpec")," and is responsible for\nconfiguring the ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/schema-model#primary-timestamp"},"primary timestamp"),". An example ",(0,r.kt)("inlineCode",{parentName:"p"},"timestampSpec")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"timestampSpec": {\n "column": "timestamp",\n "format": "auto"\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Conceptually, after input data records are read, Druid applies ingestion spec components in a particular order:\nfirst ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec"))," (if any), then ",(0,r.kt)("a",{parentName:"p",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec")),", then ",(0,r.kt)("a",{parentName:"p",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec")),",\nand finally ",(0,r.kt)("a",{parentName:"p",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec"))," and ",(0,r.kt)("a",{parentName:"p",href:"#metricsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"metricsSpec")),". Keep this in mind when writing\nyour ingestion spec.")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"timestampSpec")," can have the following components:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"column"),(0,r.kt)("td",{parentName:"tr",align:null},"Input row field to read the primary timestamp from.",(0,r.kt)("br",null),(0,r.kt)("br",null),"Regardless of the name of this input field, the primary timestamp will always be stored as a column named ",(0,r.kt)("inlineCode",{parentName:"td"},"__time")," in your Druid datasource."),(0,r.kt)("td",{parentName:"tr",align:null},"timestamp")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"format"),(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp format. Options are: ",(0,r.kt)("ul",null,(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"iso"),": ISO8601 with 'T' separator, like \"2000-01-01T01:02:03.456\""),(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"posix"),": seconds since epoch"),(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"millis"),": milliseconds since epoch"),(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"micro"),": microseconds since epoch"),(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"nano"),": nanoseconds since epoch"),(0,r.kt)("li",null,(0,r.kt)("inlineCode",{parentName:"td"},"auto"),": automatically detects ISO (either 'T' or space separator) or millis format"),(0,r.kt)("li",null,"any ",(0,r.kt)("a",{parentName:"td",href:"http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html"},"Joda DateTimeFormat string")))),(0,r.kt)("td",{parentName:"tr",align:null},"auto")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"missingValue"),(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp to use for input records that have a null or missing timestamp ",(0,r.kt)("inlineCode",{parentName:"td"},"column"),". Should be in ISO8601 format, like ",(0,r.kt)("inlineCode",{parentName:"td"},'"2000-01-01T01:02:03.456"'),", even if you have specified something else for ",(0,r.kt)("inlineCode",{parentName:"td"},"format"),". Since Druid requires a primary timestamp, this setting can be useful for ingesting datasets that do not have any per-record timestamps at all."),(0,r.kt)("td",{parentName:"tr",align:null},"none")))),(0,r.kt)("p",null,"You can use the timestamp in a expression as ",(0,r.kt)("inlineCode",{parentName:"p"},"__time")," because Druid parses the ",(0,r.kt)("inlineCode",{parentName:"p"},"timestampSpec")," before applying ",(0,r.kt)("a",{parentName:"p",href:"#transforms"},"transforms"),". You can also set the expression ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"__time")," to replace the value of the timestamp."),(0,r.kt)("p",null,"Treat ",(0,r.kt)("inlineCode",{parentName:"p"},"__time")," as a millisecond timestamp: the number of milliseconds since Jan 1, 1970 at midnight UTC."),(0,r.kt)("h3",{id:"dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"dimensionsSpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," and is responsible for\nconfiguring ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/schema-model#dimensions"},"dimensions"),"."),(0,r.kt)("p",null,"You can either manually specify the dimensions or take advantage of schema auto-discovery where you allow Druid to infer all or some of the schema for your data. This means that you don't have to explicitly specify your dimensions and their type. "),(0,r.kt)("p",null,"To use schema auto-discovery, set ",(0,r.kt)("inlineCode",{parentName:"p"},"useSchemaDiscovery")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". "),(0,r.kt)("p",null,"Alternatively, you can use the string-based schemaless ingestion where any discovered dimensions are treated as strings. To do so, leave ",(0,r.kt)("inlineCode",{parentName:"p"},"useSchemaDiscovery")," set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," (default). Then, set the dimensions list to empty or set the ",(0,r.kt)("inlineCode",{parentName:"p"},"includeAllDimensions")," property to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,r.kt)("p",null,"The following ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," example uses schema auto-discovery (",(0,r.kt)("inlineCode",{parentName:"p"},'"useSchemaDiscovery": true'),") in conjunction with explicitly defined dimensions to have Druid infer some of the schema for the data:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'"dimensionsSpec" : {\n "dimensions": [\n "page",\n "language",\n { "type": "long", "name": "userId" }\n ],\n "dimensionExclusions" : [],\n "spatialDimensions" : [],\n "useSchemaDiscovery": true\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Conceptually, after input data records are read, Druid applies ingestion spec components in a particular order:\nfirst ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec"))," (if any), then ",(0,r.kt)("a",{parentName:"p",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec")),", then ",(0,r.kt)("a",{parentName:"p",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec")),",\nand finally ",(0,r.kt)("a",{parentName:"p",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec"))," and ",(0,r.kt)("a",{parentName:"p",href:"#metricsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"metricsSpec")),". Keep this in mind when writing\nyour ingestion spec.")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," can have the following components:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")),(0,r.kt)("td",{parentName:"tr",align:null},"A list of ",(0,r.kt)("a",{parentName:"td",href:"#dimension-objects"},"dimension names or objects"),". You cannot include the same column in both ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," and ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensionExclusions"),".",(0,r.kt)("br",null),(0,r.kt)("br",null),"If ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," and ",(0,r.kt)("inlineCode",{parentName:"td"},"spatialDimensions")," are both null or empty arrays, Druid treats all columns other than timestamp or metrics that do not appear in ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensionExclusions")," as String-typed dimension columns. See ",(0,r.kt)("a",{parentName:"td",href:"#inclusions-and-exclusions"},"inclusions and exclusions")," for details.",(0,r.kt)("br",null),(0,r.kt)("br",null),"As a best practice, put the most frequently filtered dimensions at the beginning of the dimensions list. In this case, it would also be good to consider ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/ingestion/partitioning"},(0,r.kt)("inlineCode",{parentName:"a"},"partitioning"))," by those same dimensions."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"[]"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"dimensionExclusions")),(0,r.kt)("td",{parentName:"tr",align:null},"The names of dimensions to exclude from ingestion. Only names are supported here, not objects.",(0,r.kt)("br",null),(0,r.kt)("br",null),"This list is only used if the ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," and ",(0,r.kt)("inlineCode",{parentName:"td"},"spatialDimensions")," lists are both null or empty arrays; otherwise it is ignored. See ",(0,r.kt)("a",{parentName:"td",href:"#inclusions-and-exclusions"},"inclusions and exclusions")," below for details."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"[]"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"spatialDimensions")),(0,r.kt)("td",{parentName:"tr",align:null},"An array of ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/querying/geo"},"spatial dimensions"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"[]"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"includeAllDimensions")),(0,r.kt)("td",{parentName:"tr",align:null},"Note that this field only applies to string-based schema discovery where Druid ingests dimensions it discovers as strings. This is different from schema auto-discovery where Druid infers the type for data. You can set ",(0,r.kt)("inlineCode",{parentName:"td"},"includeAllDimensions")," to true to ingest both explicit dimensions in the ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," field and other dimensions that the ingestion task discovers from input data. In this case, the explicit dimensions will appear first in the order that you specify them, and the dimensions dynamically discovered will come after. This flag can be useful especially with auto schema discovery using ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec")),". If this is not set and the ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," field is not empty, Druid will ingest only explicit dimensions. If this is not set and the ",(0,r.kt)("inlineCode",{parentName:"td"},"dimensions")," field is empty, all discovered dimensions will be ingested."),(0,r.kt)("td",{parentName:"tr",align:null},"false")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"useSchemaDiscovery")),(0,r.kt)("td",{parentName:"tr",align:null},"Configure Druid to use schema auto-discovery to discover some or all of the dimensions and types for your data. For any dimensions that aren't a uniform type, Druid ingests them as JSON. You can use this for native batch or streaming ingestion."),(0,r.kt)("td",{parentName:"tr",align:null},"false")))),(0,r.kt)("h4",{id:"dimension-objects"},"Dimension objects"),(0,r.kt)("p",null,"Each dimension in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensions")," list can either be a name or an object. Providing a name is equivalent to providing\na ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," type dimension object with the given name, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},'"page"')," is equivalent to ",(0,r.kt)("inlineCode",{parentName:"p"},'{"name": "page", "type": "string"}'),"."),(0,r.kt)("p",null,"Dimension objects can have the following components:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"type"),(0,r.kt)("td",{parentName:"tr",align:null},"Either ",(0,r.kt)("inlineCode",{parentName:"td"},"auto"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"long"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"float"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"double"),", or ",(0,r.kt)("inlineCode",{parentName:"td"},"json"),". For the ",(0,r.kt)("inlineCode",{parentName:"td"},"auto")," type, Druid determines the most appropriate type for the dimension and assigns one of the following: STRING, ARRAY<STRING",">",", LONG, ARRAY<LONG",">",", DOUBLE, ARRAY<DOUBLE",">",", or COMPLEX<json",">"," columns, all sharing a common 'nested' format. When Druid infers the schema with schema auto-discovery, the type is ",(0,r.kt)("inlineCode",{parentName:"td"},"auto"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"The name of the dimension. This will be used as the field name to read from input records, as well as the column name stored in generated segments.",(0,r.kt)("br",null),(0,r.kt)("br",null),"Note that you can use a ",(0,r.kt)("a",{parentName:"td",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec"))," if you want to rename columns during ingestion time."),(0,r.kt)("td",{parentName:"tr",align:null},"none (required)")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"createBitmapIndex"),(0,r.kt)("td",{parentName:"tr",align:null},"For ",(0,r.kt)("inlineCode",{parentName:"td"},"string")," typed dimensions, whether or not bitmap indexes should be created for the column in generated segments. Creating a bitmap index requires more storage, but speeds up certain kinds of filtering (especially equality and prefix filtering). Only supported for ",(0,r.kt)("inlineCode",{parentName:"td"},"string")," typed dimensions."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"multiValueHandling"),(0,r.kt)("td",{parentName:"tr",align:null},"For ",(0,r.kt)("inlineCode",{parentName:"td"},"string")," typed dimensions, specifies the type of handling for ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/querying/multi-value-dimensions"},"multi-value fields"),". Possible values are ",(0,r.kt)("inlineCode",{parentName:"td"},"array")," (ingest string arrays as-is), ",(0,r.kt)("inlineCode",{parentName:"td"},"sorted_array")," (sort string arrays during ingestion), and ",(0,r.kt)("inlineCode",{parentName:"td"},"sorted_set")," (sort and de-duplicate string arrays during ingestion). This parameter is ignored for types other than ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"sorted_array"))))),(0,r.kt)("h4",{id:"inclusions-and-exclusions"},"Inclusions and exclusions"),(0,r.kt)("p",null,"Druid will interpret a ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec")," in two possible ways: ",(0,r.kt)("em",{parentName:"p"},"normal")," or ",(0,r.kt)("em",{parentName:"p"},"schemaless"),"."),(0,r.kt)("p",null,"Normal interpretation occurs when either ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensions")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"spatialDimensions")," is non-empty. In this case, the combination of the two lists will be taken as the set of dimensions to be ingested, and the list of ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensionExclusions")," will be ignored."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," The following description of schemaless refers to string-based schemaless where Druid treats dimensions it discovers as strings. We recommend you use schema auto-discovery instead where Druid infers the type for the dimension. For more information, see ",(0,r.kt)("a",{parentName:"p",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec")),".")),(0,r.kt)("p",null,"Schemaless interpretation occurs when both ",(0,r.kt)("inlineCode",{parentName:"p"},"dimensions")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"spatialDimensions")," are empty or null. In this case, the set of dimensions is determined in the following way:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"First, start from the set of all root-level fields from the input record, as determined by the ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/data-formats"},(0,r.kt)("inlineCode",{parentName:"a"},"inputFormat")),'. "Root-level" includes all fields at the top level of a data structure, but does not included fields nested within maps or lists. To extract these, you must use a ',(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec")),". All fields of non-nested data formats, such as CSV and delimited text, are considered root-level."),(0,r.kt)("li",{parentName:"ol"},"If a ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec"))," is being used, the set of root-level fields includes any fields generated by the ",(0,r.kt)("inlineCode",{parentName:"li"},"flattenSpec"),". The ",(0,r.kt)("inlineCode",{parentName:"li"},"useFieldDiscovery")," parameter determines whether the original root-level fields will be retained or discarded."),(0,r.kt)("li",{parentName:"ol"},"Any field listed in ",(0,r.kt)("inlineCode",{parentName:"li"},"dimensionExclusions")," is excluded."),(0,r.kt)("li",{parentName:"ol"},"The field listed as ",(0,r.kt)("inlineCode",{parentName:"li"},"column")," in the ",(0,r.kt)("a",{parentName:"li",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec"))," is excluded."),(0,r.kt)("li",{parentName:"ol"},"Any field used as an input to an aggregator from the ",(0,r.kt)("a",{parentName:"li",href:"#metricsspec"},"metricsSpec")," is excluded."),(0,r.kt)("li",{parentName:"ol"},"Any field with the same name as an aggregator from the ",(0,r.kt)("a",{parentName:"li",href:"#metricsspec"},"metricsSpec")," is excluded."),(0,r.kt)("li",{parentName:"ol"},"All other fields are ingested as ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," typed dimensions with the ",(0,r.kt)("a",{parentName:"li",href:"#dimension-objects"},"default settings"),".")),(0,r.kt)("p",null,"Additionally, if you have empty columns that you want to include in the string-based schemaless ingestion, you'll need to include the context parameter ",(0,r.kt)("inlineCode",{parentName:"p"},"storeEmptyColumns")," and set it to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Note: Fields generated by a ",(0,r.kt)("a",{parentName:"p",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec"))," are not currently considered candidates for\nschemaless dimension interpretation.")),(0,r.kt)("h3",{id:"metricsspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"metricsSpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec")," and is a list of ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/querying/aggregations"},"aggregators"),"\nto apply at ingestion time. This is most useful when ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/rollup"},"rollup")," is enabled, since it's how you configure\ningestion-time aggregation."),(0,r.kt)("p",null,"An example ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"metricsSpec": [\n { "type": "count", "name": "count" },\n { "type": "doubleSum", "name": "bytes_added_sum", "fieldName": "bytes_added" },\n { "type": "doubleSum", "name": "bytes_deleted_sum", "fieldName": "bytes_deleted" }\n]\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Generally, when ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/rollup"},"rollup")," is disabled, you should have an empty ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec")," (because without rollup,\nDruid does not do any ingestion-time aggregation, so there is little reason to include an ingestion-time aggregator). However,\nin some cases, it can still make sense to define metrics: for example, if you want to create a complex column as a way of\npre-computing part of an ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/querying/aggregations#approximate-aggregations"},"approximate aggregation"),", this can only\nbe done by defining a metric in a ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec"),".")),(0,r.kt)("h3",{id:"granularityspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"granularitySpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," and is responsible for configuring\nthe following operations:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Partitioning a datasource into ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/design/architecture#datasources-and-segments"},"time chunks")," (via ",(0,r.kt)("inlineCode",{parentName:"li"},"segmentGranularity"),")."),(0,r.kt)("li",{parentName:"ol"},"Truncating the timestamp, if desired (via ",(0,r.kt)("inlineCode",{parentName:"li"},"queryGranularity"),")."),(0,r.kt)("li",{parentName:"ol"},"Specifying which time chunks of segments should be created, for batch ingestion (via ",(0,r.kt)("inlineCode",{parentName:"li"},"intervals"),")."),(0,r.kt)("li",{parentName:"ol"},"Specifying whether ingestion-time ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/rollup"},"rollup")," should be used or not (via ",(0,r.kt)("inlineCode",{parentName:"li"},"rollup"),").")),(0,r.kt)("p",null,"Other than ",(0,r.kt)("inlineCode",{parentName:"p"},"rollup"),", these operations are all based on the ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/schema-model#primary-timestamp"},"primary timestamp"),"."),(0,r.kt)("p",null,"An example ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"granularitySpec": {\n "segmentGranularity": "day",\n "queryGranularity": "none",\n "intervals": [\n "2013-08-31/2013-09-01"\n ],\n "rollup": true\n}\n')),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"granularitySpec")," can have the following components:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"type"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"uniform")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"uniform"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"segmentGranularity"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/design/architecture#datasources-and-segments"},"Time chunking")," granularity for this datasource. Multiple segments can be created per time chunk. For example, when set to ",(0,r.kt)("inlineCode",{parentName:"td"},"day"),", the events of the same day fall into the same time chunk which can be optionally further partitioned into multiple segments based on other configurations and input size. Any ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/querying/granularities"},"granularity")," can be provided here. Note that all segments in the same time chunk should have the same segment granularity.",(0,r.kt)("br",null),(0,r.kt)("br",null),"Avoid ",(0,r.kt)("inlineCode",{parentName:"td"},"WEEK")," granularity for data partitioning because weeks don't align neatly with months and years, making it difficult to change partitioning by coarser granularity. Instead, opt for other partitioning options such as ",(0,r.kt)("inlineCode",{parentName:"td"},"DAY")," or ",(0,r.kt)("inlineCode",{parentName:"td"},"MONTH"),", which offer more flexibility."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"day"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"queryGranularity"),(0,r.kt)("td",{parentName:"tr",align:null},"The resolution of timestamp storage within each segment. This must be equal to, or finer, than ",(0,r.kt)("inlineCode",{parentName:"td"},"segmentGranularity"),". This will be the finest granularity that you can query at and still receive sensible results, but note that you can still query at anything coarser than this granularity. E.g., a value of ",(0,r.kt)("inlineCode",{parentName:"td"},"minute")," will mean that records will be stored at minutely granularity, and can be sensibly queried at any multiple of minutes (including minutely, 5-minutely, hourly, etc).",(0,r.kt)("br",null),(0,r.kt)("br",null),"Any ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/querying/granularities"},"granularity")," can be provided here. Use ",(0,r.kt)("inlineCode",{parentName:"td"},"none")," to store timestamps as-is, without any truncation. Note that ",(0,r.kt)("inlineCode",{parentName:"td"},"rollup")," will be applied if it is set even when the ",(0,r.kt)("inlineCode",{parentName:"td"},"queryGranularity")," is set to ",(0,r.kt)("inlineCode",{parentName:"td"},"none"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"none"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"rollup"),(0,r.kt)("td",{parentName:"tr",align:null},"Whether to use ingestion-time ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/ingestion/rollup"},"rollup")," or not. Note that rollup is still effective even when ",(0,r.kt)("inlineCode",{parentName:"td"},"queryGranularity")," is set to ",(0,r.kt)("inlineCode",{parentName:"td"},"none"),". Your data will be rolled up if they have the exactly same timestamp."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"intervals"),(0,r.kt)("td",{parentName:"tr",align:null},"A list of intervals defining time chunks for segments. Specify interval values using ISO8601 format. For example, ",(0,r.kt)("inlineCode",{parentName:"td"},'["2021-12-06T21:27:10+00:00/2021-12-07T00:00:00+00:00"]'),'. If you omit the time, the time defaults to "00:00:00".',(0,r.kt)("br",null),(0,r.kt)("br",null),"Druid breaks the list up and rounds off the list values based on the ",(0,r.kt)("inlineCode",{parentName:"td"},"segmentGranularity"),".",(0,r.kt)("br",null),(0,r.kt)("br",null),"If ",(0,r.kt)("inlineCode",{parentName:"td"},"null")," or not provided, batch ingestion tasks generally determine which time chunks to output based on the timestamps found in the input data.",(0,r.kt)("br",null),(0,r.kt)("br",null),"If specified, batch ingestion tasks may be able to skip a determining-partitions phase, which can result in faster ingestion. Batch ingestion tasks may also be able to request all their locks up-front instead of one by one. Batch ingestion tasks throw away any records with timestamps outside of the specified intervals.",(0,r.kt)("br",null),(0,r.kt)("br",null),"Ignored for any form of streaming ingestion."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"null"))))),(0,r.kt)("h3",{id:"transformspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"transformSpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"transformSpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"transformSpec")," and is responsible for transforming and filtering\nrecords during ingestion time. It is optional. An example ",(0,r.kt)("inlineCode",{parentName:"p"},"transformSpec")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"transformSpec": {\n "transforms": [\n { "type": "expression", "name": "countryUpper", "expression": "upper(country)" }\n ],\n "filter": {\n "type": "selector",\n "dimension": "country",\n "value": "San Serriffe"\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Conceptually, after input data records are read, Druid applies ingestion spec components in a particular order:\nfirst ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec"))," (if any), then ",(0,r.kt)("a",{parentName:"p",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec")),", then ",(0,r.kt)("a",{parentName:"p",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec")),",\nand finally ",(0,r.kt)("a",{parentName:"p",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec"))," and ",(0,r.kt)("a",{parentName:"p",href:"#metricsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"metricsSpec")),". Keep this in mind when writing\nyour ingestion spec.")),(0,r.kt)("h4",{id:"transforms"},"Transforms"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"transforms"),' list allows you to specify a set of expressions to evaluate on top of input data. Each transform has a\n"name" which can be referred to by your ',(0,r.kt)("inlineCode",{parentName:"p"},"dimensionsSpec"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"metricsSpec"),", etc."),(0,r.kt)("p",null,'If a transform has the same name as a field in an input row, then it will shadow the original field. Transforms that\nshadow fields may still refer to the fields they shadow. This can be used to transform a field "in-place".'),(0,r.kt)("p",null,"Transforms do have some limitations. They can only refer to fields present in the actual input rows; in particular,\nthey cannot refer to other transforms. And they cannot remove fields, only add them. However, they can shadow a field\nwith another field containing all nulls, which will act similarly to removing the field."),(0,r.kt)("p",null,"Druid currently includes one kind of built-in transform, the expression transform. It has the following syntax:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "type": "expression",\n "name": "<output name>",\n "expression": "<expr>"\n}\n')),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"expression")," is a ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/querying/math-expr"},"Druid query expression"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Conceptually, after input data records are read, Druid applies ingestion spec components in a particular order:\nfirst ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec"))," (if any), then ",(0,r.kt)("a",{parentName:"p",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec")),", then ",(0,r.kt)("a",{parentName:"p",href:"#transformspec"},(0,r.kt)("inlineCode",{parentName:"a"},"transformSpec")),",\nand finally ",(0,r.kt)("a",{parentName:"p",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec"))," and ",(0,r.kt)("a",{parentName:"p",href:"#metricsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"metricsSpec")),". Keep this in mind when writing\nyour ingestion spec.")),(0,r.kt)("h4",{id:"filter"},"Filter"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"filter")," conditionally filters input rows during ingestion. Only rows that pass the filter will be\ningested. Any of Druid's standard ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/querying/filters"},"query filters")," can be used. Note that within a\n",(0,r.kt)("inlineCode",{parentName:"p"},"transformSpec"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"transforms")," are applied before the ",(0,r.kt)("inlineCode",{parentName:"p"},"filter"),", so the filter can refer to a transform."),(0,r.kt)("h3",{id:"legacy-dataschema-spec"},"Legacy ",(0,r.kt)("inlineCode",{parentName:"h3"},"dataSchema")," spec"),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," The ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," spec has been changed in 0.17.0. The new spec is supported by all ingestion methods\nexcept for ",(0,r.kt)("em",{parentName:"p"},"Hadoop")," ingestion. See ",(0,r.kt)("a",{parentName:"p",href:"#dataschema"},(0,r.kt)("inlineCode",{parentName:"a"},"dataSchema"))," for the new spec.")),(0,r.kt)("p",null,"The legacy ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," spec has below two more components in addition to the ones listed in the ",(0,r.kt)("a",{parentName:"p",href:"#dataschema"},(0,r.kt)("inlineCode",{parentName:"a"},"dataSchema"))," section above."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#parser-deprecated"},"input row parser"),", ",(0,r.kt)("a",{parentName:"li",href:"#flattenspec"},"flattening of nested data")," (if needed)")),(0,r.kt)("h4",{id:"parser-deprecated"},(0,r.kt)("inlineCode",{parentName:"h4"},"parser")," (Deprecated)"),(0,r.kt)("p",null,"In legacy ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," is located in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," and is responsible for configuring a wide variety of\nitems related to parsing input records. The ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," is deprecated and it is highly recommended to use ",(0,r.kt)("inlineCode",{parentName:"p"},"inputFormat")," instead.\nFor details about ",(0,r.kt)("inlineCode",{parentName:"p"},"inputFormat")," and supported ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," types, see the ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats"},'"Data formats" page'),"."),(0,r.kt)("p",null,"For details about major components of the ",(0,r.kt)("inlineCode",{parentName:"p"},"parseSpec"),", refer to their subsections:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#timestampspec"},(0,r.kt)("inlineCode",{parentName:"a"},"timestampSpec")),", responsible for configuring the ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/schema-model#primary-timestamp"},"primary timestamp"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#dimensionsspec"},(0,r.kt)("inlineCode",{parentName:"a"},"dimensionsSpec")),", responsible for configuring ",(0,r.kt)("a",{parentName:"li",href:"/docs/28.0.1/ingestion/schema-model#dimensions"},"dimensions"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#flattenspec"},(0,r.kt)("inlineCode",{parentName:"a"},"flattenSpec")),", responsible for flattening nested data formats.")),(0,r.kt)("p",null,"An example ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'"parser": {\n "type": "string",\n "parseSpec": {\n "format": "json",\n "flattenSpec": {\n "useFieldDiscovery": true,\n "fields": [\n { "type": "path", "name": "userId", "expr": "$.user.id" }\n ]\n },\n "timestampSpec": {\n "column": "timestamp",\n "format": "auto"\n },\n "dimensionsSpec": {\n "dimensions": [\n "page",\n "language",\n { "type": "long", "name": "userId" }\n ]\n }\n }\n}\n')),(0,r.kt)("h4",{id:"flattenspec"},(0,r.kt)("inlineCode",{parentName:"h4"},"flattenSpec")),(0,r.kt)("p",null,"In the legacy ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"flattenSpec")," is located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"parser")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"parseSpec")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"flattenSpec")," and is responsible for\nbridging the gap between potentially nested input data (such as JSON, Avro, etc) and Druid's flat data model.\nSee ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/data-formats#flattenspec"},"Flatten spec")," for more details."),(0,r.kt)("h2",{id:"ioconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"ioConfig")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"ioConfig")," influences how data is read from a source system, such as Apache Kafka, Amazon S3, a mounted\nfilesystem, or any other supported source system. The ",(0,r.kt)("inlineCode",{parentName:"p"},"inputFormat")," property applies to all\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method")," except for Hadoop ingestion. The Hadoop ingestion still\nuses the ",(0,r.kt)("a",{parentName:"p",href:"#parser-deprecated"},(0,r.kt)("inlineCode",{parentName:"a"},"parser"))," in the legacy ",(0,r.kt)("inlineCode",{parentName:"p"},"dataSchema"),".\nThe rest of ",(0,r.kt)("inlineCode",{parentName:"p"},"ioConfig")," is specific to each individual ingestion method.\nAn example ",(0,r.kt)("inlineCode",{parentName:"p"},"ioConfig")," to read JSON data is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'"ioConfig": {\n "type": "<ingestion-method-specific type code>",\n "inputFormat": {\n "type": "json"\n },\n ...\n}\n')),(0,r.kt)("p",null,"For more details, see the documentation provided by each ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method"),"."),(0,r.kt)("h2",{id:"tuningconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"tuningConfig")),(0,r.kt)("p",null,"Tuning properties are specified in a ",(0,r.kt)("inlineCode",{parentName:"p"},"tuningConfig"),", which goes at the top level of an ingestion spec. Some\nproperties apply to all ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion methods"),", but most are specific to each individual\ningestion method. An example ",(0,r.kt)("inlineCode",{parentName:"p"},"tuningConfig")," that sets all of the shared, common properties to their defaults\nis:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-plaintext"},'"tuningConfig": {\n "type": "<ingestion-method-specific type code>",\n "maxRowsInMemory": 1000000,\n "maxBytesInMemory": <one-sixth of JVM memory>,\n "indexSpec": {\n "bitmap": { "type": "roaring" },\n "dimensionCompression": "lz4",\n "metricCompression": "lz4",\n "longEncoding": "longs"\n },\n <other ingestion-method-specific properties>\n}\n')),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"type"),(0,r.kt)("td",{parentName:"tr",align:null},"Each ingestion method has its own tuning type code. You must specify the type code that matches your ingestion method. Common options are ",(0,r.kt)("inlineCode",{parentName:"td"},"index"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"hadoop"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"kafka"),", and ",(0,r.kt)("inlineCode",{parentName:"td"},"kinesis"),"."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"maxRowsInMemory"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum number of records to store in memory before persisting to disk. Note that this is the number of rows\xa0post-rollup, and so it may not be equal to the number of input records. Ingested records will be persisted to disk when either ",(0,r.kt)("inlineCode",{parentName:"td"},"maxRowsInMemory")," or ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," are reached (whichever happens first)."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"1000000"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"maxBytesInMemory"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum aggregate size of records, in bytes, to store in the JVM heap before persisting. This is based on a rough estimate of memory usage. Ingested records will be persisted to disk when either ",(0,r.kt)("inlineCode",{parentName:"td"},"maxRowsInMemory")," or ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," are reached (whichever happens first). ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," also includes heap usage of artifacts created from intermediary persists. This means that after every persist, the amount of ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," until the next persist will decrease. If the sum of bytes of all intermediary persisted artifacts exceeds ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," the task fails.",(0,r.kt)("br",null),(0,r.kt)("br",null),"Setting ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," to -1 disables this check, meaning Druid will rely entirely on ",(0,r.kt)("inlineCode",{parentName:"td"},"maxRowsInMemory")," to control memory usage. Setting it to zero means the default value will be used (one-sixth of JVM heap size).",(0,r.kt)("br",null),(0,r.kt)("br",null),"Note that the estimate of memory usage is designed to be an overestimate, and can be especially high when using complex ingest-time aggregators, including sketches. If this causes your indexing workloads to persist to disk too often, you can set ",(0,r.kt)("inlineCode",{parentName:"td"},"maxBytesInMemory")," to -1 and rely on ",(0,r.kt)("inlineCode",{parentName:"td"},"maxRowsInMemory")," instead."),(0,r.kt)("td",{parentName:"tr",align:null},"One-sixth of max JVM heap size")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"skipBytesInMemoryOverheadCheck"),(0,r.kt)("td",{parentName:"tr",align:null},"The calculation of maxBytesInMemory takes into account overhead objects created during ingestion and each intermediate persist. Setting this to true can exclude the bytes of these overhead objects from maxBytesInMemory check."),(0,r.kt)("td",{parentName:"tr",align:null},"false")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"indexSpec"),(0,r.kt)("td",{parentName:"tr",align:null},"Defines segment storage format options to use at indexing time."),(0,r.kt)("td",{parentName:"tr",align:null},"See ",(0,r.kt)("a",{parentName:"td",href:"#indexspec"},(0,r.kt)("inlineCode",{parentName:"a"},"indexSpec"))," for more information.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"indexSpecForIntermediatePersists"),(0,r.kt)("td",{parentName:"tr",align:null},"Defines segment storage format options to use at indexing time for intermediate persisted temporary segments."),(0,r.kt)("td",{parentName:"tr",align:null},"See ",(0,r.kt)("a",{parentName:"td",href:"#indexspec"},(0,r.kt)("inlineCode",{parentName:"a"},"indexSpec"))," for more information.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Other properties"),(0,r.kt)("td",{parentName:"tr",align:null},"Each ingestion method has its own list of additional tuning properties. See the documentation for each method for a full list: ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/development/extensions-core/kafka-supervisor-reference#supervisor-tuning-configuration"},"Kafka indexing service"),", ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/development/extensions-core/kinesis-ingestion#supervisor-tuning-configuration"},"Kinesis indexing service"),", ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/ingestion/native-batch#tuningconfig"},"Native batch"),", and ",(0,r.kt)("a",{parentName:"td",href:"/docs/28.0.1/ingestion/hadoop#tuningconfig"},"Hadoop-based"),"."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"indexspec"},(0,r.kt)("inlineCode",{parentName:"h3"},"indexSpec")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"indexSpec")," object can include the following properties:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Default"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bitmap"),(0,r.kt)("td",{parentName:"tr",align:null},"Compression format for bitmap indexes. Should be a JSON object with ",(0,r.kt)("inlineCode",{parentName:"td"},"type")," set to ",(0,r.kt)("inlineCode",{parentName:"td"},"roaring")," or ",(0,r.kt)("inlineCode",{parentName:"td"},"concise"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},'{"type": "roaring"}'))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"dimensionCompression"),(0,r.kt)("td",{parentName:"tr",align:null},"Compression format for dimension columns. Options are ",(0,r.kt)("inlineCode",{parentName:"td"},"lz4"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"lzf"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"zstd"),", or ",(0,r.kt)("inlineCode",{parentName:"td"},"uncompressed"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"lz4"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"stringDictionaryEncoding"),(0,r.kt)("td",{parentName:"tr",align:null},"Encoding format for STRING value dictionaries used by STRING and COMPLEX","<","json",">"," columns. ",(0,r.kt)("br",null),(0,r.kt)("br",null),"Example to enable front coding: ",(0,r.kt)("inlineCode",{parentName:"td"},'{"type":"frontCoded", "bucketSize": 4}'),(0,r.kt)("br",null),(0,r.kt)("inlineCode",{parentName:"td"},"bucketSize")," is the number of values to place in a bucket to perform delta encoding. Must be a power of 2, maximum is 128. Defaults to 4.",(0,r.kt)("br",null)," ",(0,r.kt)("inlineCode",{parentName:"td"},"formatVersion")," can specify older versions for backwards compatibility during rolling upgrades, valid options are ",(0,r.kt)("inlineCode",{parentName:"td"},"0")," and ",(0,r.kt)("inlineCode",{parentName:"td"},"1"),". Defaults to ",(0,r.kt)("inlineCode",{parentName:"td"},"0")," for backwards compatibility.",(0,r.kt)("br",null),(0,r.kt)("br",null),"See ",(0,r.kt)("a",{parentName:"td",href:"#front-coding"},"Front coding")," for more information."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},'{"type":"utf8"}'))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"metricCompression"),(0,r.kt)("td",{parentName:"tr",align:null},"Compression format for primitive type metric columns. Options are ",(0,r.kt)("inlineCode",{parentName:"td"},"lz4"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"lzf"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"zstd"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"uncompressed"),", or ",(0,r.kt)("inlineCode",{parentName:"td"},"none")," (which is more efficient than ",(0,r.kt)("inlineCode",{parentName:"td"},"uncompressed"),", but not supported by older versions of Druid)."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"lz4"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"longEncoding"),(0,r.kt)("td",{parentName:"tr",align:null},"Encoding format for long-typed columns. Applies regardless of whether they are dimensions or metrics. Options are ",(0,r.kt)("inlineCode",{parentName:"td"},"auto")," or ",(0,r.kt)("inlineCode",{parentName:"td"},"longs"),". ",(0,r.kt)("inlineCode",{parentName:"td"},"auto")," encodes the values using offset or lookup table depending on column cardinality, and store them with variable size. ",(0,r.kt)("inlineCode",{parentName:"td"},"longs")," stores the value as-is with 8 bytes each."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"longs"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"jsonCompression"),(0,r.kt)("td",{parentName:"tr",align:null},"Compression format to use for nested column raw data. Options are ",(0,r.kt)("inlineCode",{parentName:"td"},"lz4"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"lzf"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"zstd"),", or ",(0,r.kt)("inlineCode",{parentName:"td"},"uncompressed"),"."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"lz4"))))),(0,r.kt)("h5",{id:"front-coding"},"Front coding"),(0,r.kt)("p",null,"Front coding is an experimental feature starting in version 25.0. Front coding is an incremental encoding strategy that Druid can use to store STRING and ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/querying/nested-columns"},"COMPLEX","<","json",">")," columns. It allows Druid to create smaller UTF-8 encoded segments with very little performance cost."),(0,r.kt)("p",null,"You can enable front coding with all types of ingestion. For information on defining an ",(0,r.kt)("inlineCode",{parentName:"p"},"indexSpec")," in a query context, see ",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/multi-stage-query/reference#context-parameters"},"SQL-based ingestion reference"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"}," Front coding was originally introduced in Druid 25.0, and an improved 'version 1' was introduced in Druid 26.0, with typically faster read speed and smaller storage size. The current recommendation is to enable it in a staging environment and fully test your use case before using in production. By default, segments created with front coding enabled in Druid 26.0 are backwards compatible with Druid 25.0, but those created with Druid 26.0 or 25.0 are not compatible with Druid versions older than 25.0. If using front coding in Druid 25.0 and upgrading to Druid 26.0, the ",(0,r.kt)("inlineCode",{parentName:"p"},"formatVersion")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," to keep writing out the older format to enable seamless downgrades to Druid 25.0, and then later is recommended to be changed to ",(0,r.kt)("inlineCode",{parentName:"p"},"1")," once determined that rollback is not necessary.")),(0,r.kt)("p",null,"Beyond these properties, each ingestion method has its own specific tuning properties. See the documentation for each\n",(0,r.kt)("a",{parentName:"p",href:"/docs/28.0.1/ingestion/#ingestion-methods"},"ingestion method")," for details."))}h.isMDXComponent=!0}}]);