Categories
Development

Multi-Term Auto Completion Elasticsearch

I am using Elasticsearch 7.2.0 and i want to create search suggestion. For example i have these 3 movies titles: Avengers: Infinity War Avengers: Infinity War Part 2 Avengers: Age of Ultron When i type “avan” should return suggestion like: avangers avangers infinity avangers age When i type “avangers inf“ avangers infinity war avangers infinity […]

Categories
Development

Adding new documents to elasticsearch with mapping via elasticsearch.index, body structure

I’m building blog-like app with flask (based on Miguel Grinberg Megatutorial) and I’m trying to setup ES indexing that would support autocomplete feature. I’m struggling with setting up indexing correctly. I started with (working) simple indexing mechanism: from flask import current_app def add_to_index(index, model): if not current_app.elasticsearch: return payload = {} for field in model.__searchable__: […]