[英]indexing numeric field as both int and string in elastic search
How can I index a numeric field as both a integer and string using multi_field . 如何使用multi_field将数字字段同时索引为整数和字符串。 As multi_field is deprecated now.
由于multi_field现在已弃用。 How can I achieve the same using the "fields" field in version 2.x.
如何使用2.x版中的“字段”字段来实现相同目的。 I have heard that a field can be indexing and analysed in different ways using "fields".
我听说可以使用“字段”以不同的方式对字段进行索引和分析。 But can it be indexed as different types in elastic search?
但是可以在弹性搜索中将其索引为不同类型吗?
The issue that I am facing is the classical numeric field search highlighting issue in elastic search.where I could not get numeric fields highlighting. 我面临的问题是弹性搜索中的经典数字字段搜索突出显示问题。在此无法获得数字字段突出显示。 So I want to index the field as string and int so that I can search, highlight and perform range operations on the data.
因此,我想将该字段索引为字符串和整数,以便可以搜索,突出显示和对数据执行范围操作。
You can use fields
like this to have your numeric as string
as well: 您可以使用如下
fields
将数字也作为string
:
{
"mappings": {
"test": {
"properties": {
"my_numeric": {
"type": "integer",
"fields": {
"as_string": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.