【发布时间】:2021-03-17 11:04:14
【问题描述】:
我正在尝试利用 ElasticSearch 来存储大量数据。大多数数据都是可搜索的,但是,有一些字段会在那里,以便数据被存储并根据请求返回。
这是我的地图
{
"mappings": {
"properties": {
"amenities": {
"type": "completion"
},
"summary": {
"type": "text"
},
"street_number": {
"type": "text"
},
"street_name": {
"type": "text"
},
"street_suffix": {
"type": "text"
},
"city": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
},
"state_or_province": {
"type": "text"
},
"postal_code": {
"type": "text"
},
"mlsid": {
"type": "text"
},
"source_id": {
"type": "text"
},
"status": {
"type": "keyword"
},
"type": {
"type": "keyword"
},
"subtype": {
"type": "keyword"
},
"year_built": {
"type": "short"
},
"community": {
"type": "keyword"
},
"elementary_school": {
"type": "keyword"
},
"middle_school": {
"type": "keyword"
},
"jr_high_school": {
"type": "keyword"
},
"high_school": {
"type": "keyword"
},
"area_size": {
"type": "double"
},
"lot_size": {
"type": "double"
},
"bathrooms": {
"type": "double"
},
"bedrooms": {
"type": "double"
},
"listed_at": {
"type": "date"
},
"price": {
"type": "double"
},
"sold_at": {
"type": "date"
},
"sold_for": {
"type": "double"
},
"total_photos": {
"type": "short"
},
"formatted_addressLine": {
"type": "text"
},
"formatted_address": {
"type": "text"
},
"location": {
"type": "geo_point"
},
"price_changes": {
"type": "object"
},
"fields": {
"type": "object"
},
"deleted_at": {
"type": "date"
},
"is_available": {
"type": "boolean"
},
"is_unable_to_find_coordinates": {
"type": "boolean"
},
"source": {
"type": "keyword"
}
}
}
}
fields 和 price_changes 属性可以在用户想要阅读该信息时使用。但该信息不应该是可搜索或索引的。 fields 包含大量 key-value 对,而 price_changes 字段包含多个相同类型的对象。
目前,当我尝试批量创建记录时,我收到Limit of total fields [1000] has been exceeded 错误。我猜这个错误正在发生,因为 fields 集合中的每个键值对都被认为是 elasticsearch 中的一个字段。
如何将fields 和price_changes 对象存储为不可搜索的数据,而不是将其编入索引或计入字段计数?
【问题讨论】:
标签: elasticsearch