![](/img/trans.png)
[英]Python ElasticSearch dsl: How do I represent a field to be a mapping from a string to a list of ints?
[英]Python ElasticSearch DSL: How to map String field that's not analyzed?
示例代碼仍然創建分析的 ES 字符串字段。
試過這個:
username = String(fields={'raw': String(index='not_analyzed')})
而這個:
username = String(index="not_analyzed")
嘗試在定義username
的類上調用<className>.init()
。 那應該在 ES 中創建映射。
有關更多信息,請參閱http://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html?highlight=init#document-life-cycle 。
對於最新的 elasticsearch, String
數據類型被替換為Text
和Keyword
所以為了不分析字符串,
from elasticsearch_dsl import Keyword
username = Keyword(index=False)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.