I am trying to figure out how to setup my index mapping.
I currently have all my documents in one index and under one type. However, there is one field (~2000+ unique terms) in my document that could be used as a _type mapping. I am wondering if there is any difference in query performance if that field is a type mapping vs. as a single field. AFAIK, all a type mapping does is insert a _type field for that document.
I'd use the field over the type mapping. Just make sure it is a number or a keyword. That gives you the flexibility to make it multi-valued if you find you have to do that one day. Honestly, one type per index is way, way simpler if you can get away with it.
In 99% of the cases filtering on type is the same speed as filtering one term. If you happen to want to allow any one of many terms then filtering on a terms query is actually going to be faster.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.