Schemaless mode overview and best practices
Schemaless mode removes the need to design a schema before beginning to use Search. This can help you begin using Search more quickly, but schemaless mode is typically less efficient and effective than using a deliberately designed schema.
With the default non-schemaless mode, you create a schema by writing a
schema.xml file before loading data into Solr so it can be used by Cloudera
Search. You typically write a different schema definition for each type of data being ingested,
because the different data types usually have different field names and values. Writing a custom
schema is done by examining the data to be imported so its structure can be understood, and then
creating a schema that accommodates that data. For example, emails might have a field for
recipients and log files might have a field for IP addresses for machines reporting errors.
Conversely, emails typically do not have an IP address field and log files typically do not have
recipients. Therefore, the schema you use to import emails is different from the schema you use
to import log files.
Cloudera Search offers schemaless mode to help facilitate sample deployments without the need to pre-define a schema. While schemaless is not suitable for production environments, it can help demonstrate the functionality and features of Cloudera Search. Schemaless mode operates based on three principles:
- The schema is automatically updated using an API. When not using
schemaless mode, users manually modify the
schema.xmlfile or use the Schema API.
- As data is ingested, it is analyzed and a guess is made about the type of data in the field. Supported types include Boolean, Integer, Long, Float, Double, Date, and Text.
- When a new field is encountered, the schema is automatically updated using the API. The update is based on the guess about the type of data in the field.
For example, if schemaless encounters a field that contains "6.022", this would be determined to be type Float, whereas "Mon May 04 09:51:52 CDT 2009" would be determined to be type Date.
- Starts without a populated schema.
- Intakes and analyzes data.
- Modifies the schema based on guesses about the data.
- Ingests the data so it can be searched based on the schema updates.
To generate a configuration for use in Schemaless mode, use
--generate path -schemaless. Then, create the instancedir and collection as with
Give each collection its own unique Instancedir
Solr supports using the same instancedir for multiple collections. In schemaless mode, automatic schema field additions actually change the underlying instancedir. Thus, if two collections are using the same instancedir, schema field additions meant for one collection will actually affect the other one as well. Therefore, Cloudera recommends that each collection have its own instancedir.