Hi All,
For empty fields, should I use null
or ""
? What is the best practice? Are they equivalent?
Thanks!
Hi All,
For empty fields, should I use null
or ""
? What is the best practice? Are they equivalent?
Thanks!
can you share more context, perhaps even screenshots?
Sure! For example, lets say that I have an index with user information. There is a field for age (type long). There could be cases where the age is not known. Which value should I use for the age field when inserting the record (null
or ""
)? They both seem to work. I am wondering which one would be better.
PUT users/_doc/1
{
"user": "kimchy",
"age": ""
}
vs
PUT users/_doc/1
{
"user": "kimchy",
"age": null
}
Can you please explain why this is better?
Will it help with better performance in queries?
How about other options as not adding this field at all or some default value (e.g.: -1) ?
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.