elasticsearch是否将空字符串视为null? [英] Does elasticsearch consider empty string as null?
问题描述
我想知道elasticsearch是否将空字符串视为空值,但是基于下面显示的映射,我看不到它正在这样做.如何让Elasticsearch将空字符串视为 null
并使用 null_value
提供的值进行索引.我的映射如下所示:
I would like to know if elasticsearch considers empty string as null value, but based on my mapping shown below, I don't see that it is doing that. How can I make elasticsearch consider empty string as a null
and index using the value provided by null_value
. My mapping is shown below:
{
"mapping": {
"my_typee": {
"properties": {
"autoRank": {
"type": "integer",
"null_value": 0,
"store": true,
"index": "analyzed"
}
}
}
}
}
谢谢.
推荐答案
Elasticsearch不会索引空字符串.在您的情况下,您的字段实际上不是字符串,而是类型的整数.而 null_value
选项实际上就是您想要做的.您无需执行任何其他操作.
Elasticsearch does not index empty strings. In your case your field is actually not string but an integer of type. And null_value
option is actually does what you want to do. You dont need to do anything extra.
https://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/null-value.html
这篇关于elasticsearch是否将空字符串视为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!