简体   繁体   English

将索引设置添加到弹性搜索

[英]Add index settings to elastic search

How do I add index settings to haystack with elastic backend , like this guy has added in the question? 我该如何在具有弹性backend haystack添加索引设置,就像这个人在问题中添加的那样?

django-haystack autocomplete returns too wide results django-haystack自动完成返回的结果太宽

My ngram search is returning all the docs. 我的ngram搜索返回所有文档。 When I rebuild my index the mapping is automatically taken from the model. 当我重建索引时,映射会自动从模型中获取。

I found an answer. 我找到了答案。 This link can help in creating custom elastic search settings : https://wellfire.co/learn/custom-haystack-elasticsearch-backend/ 该链接可以帮助创建自定义弹性搜索设置: https : //wellfire.co/learn/custom-haystack-elasticsearch-backend/

You have to inherit ElasticsearchSearchBackend to make a new CustomElasticsearchBackend and set the custom elasticsearch settings dict in the init of that class. 您必须继承ElasticsearchSearchBackend以创建新的CustomElasticsearchBackend,并在该类的init中设置自定义elasticsearch设置dict。

There can be a lot more that can be done using the same idea. 使用相同的想法可以做更多的事情。 Like making the build_schema function to work differently. 就像使build_schema函数以不同的方式工作一样。 Also the Fields of haystack like CharField, NgramField, EdgeNgramField can be inherited to make custom fields to work for you. 此外,可以继承干草堆的字段,例如CharField,NgramField,EdgeNgramField,以使自定义字段适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM