Reputation: 2417
The sample code still creates ES string field that's analyzed.
Tried this:
username = String(fields={'raw': String(index='not_analyzed')})
And this:
username = String(index="not_analyzed")
Upvotes: 3
Views: 1682
Reputation: 511
For the latest elasticsearch, String
datatype is replaced by Text
and Keyword
So for not analyze the string,
from elasticsearch_dsl import Keyword
username = Keyword(index=False)
Upvotes: 0
Reputation: 370
Try calling <className>.init()
on the class where you're defining username
. That should create the mappings in ES.
See http://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html?highlight=init#document-life-cycle for more info.
Upvotes: 1