Using Schemaless Mode (CDH 5.1 or later only)
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 types usually have different field names and values. This 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.
- The schema is automatically updated using an API. When not using schemaless mode, users manually modify the schema.xml file 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.
- 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 solrctl instancedir --generate path -schemaless. Then, create the instancedir and collection as with non-schemaless mode. For more information, see Solrctl Reference.
User Defined Schemas Recommended for Production Use Cases
Schemaless Solr is useful for getting started quickly and for understanding the underlying structure of the data you wish to search. However, Schemaless Solr is not recommended for production use cases. Because the schema is automatically generated, a mistake like misspelling the name of the field alters the schema, rather than producing an error. The mistake may not be caught until much later and once caught, may require reindexing to fix. Also, an unexpected input format may cause the type guessing to pick a field type that is incompatible with data that is subsequently ingested, preventing further ingestion until the incompatibility is manually addressed. Such a case is rare, but could occur. For example, if the first instance of a field was an integer, such as '9', but subsequent entries were text such as '10 Spring Street', the schema would make it impossible to properly ingest those subsequent entries. Therefore, Schemaless Solr may be useful for deciding on a schema during the exploratory stage of development, but Cloudera recommends defining the schema in the traditional way before moving to production.
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, it is recommended that each collection have its own instancedir.