Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python ElasticSearch DSL: How to map String field that's not analyzed?

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")
like image 711
lairtech Avatar asked Dec 12 '25 21:12

lairtech


1 Answers

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.

like image 50
concrete_d Avatar answered Dec 15 '25 10:12

concrete_d



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!