Мой вопрос связан с упругим поиском с использованием python. Я знаю, что мы можем выполнять сопоставления таким образом
esearch.indices.create(index='test-index', body = request_body,ignore=400)
, где
request_body =
{"mappings":
{"TestDocType":
{
"properties":
{
"id":{"type":"integer"},
"name":{"type":"text"},
"description":{"type":"text"}
}
}
}
}
, но я хочу получить сопоставления изкласс как этот
import json
from elasticsearch_dsl import String, Integer, Float, Date, Boolean
from profile_doc import ProfileDocType
class TestDocType(ProfileDocType):
id = Integer()
title = String()
description = String()
class Meta:
index = "Test-index"
def serialize(self, prod):
return {
'id': prod.id,
'name': prod.title,
'description': prod.description,
}
где ProfileDocType равен
from datetime import datetime
from elasticsearch_dsl import DocType
class ProfileDocType(DocType):
def serialize(self, profile):
profile["updated_on"] = str(datetime.now())
return profile
Я хочу получить отображение класса TestDocType и добавить его в индекс, как это можно сделать?если вы не понимаете, что я имею в виду, пожалуйста, проверьте autopping в упругом поиске c # https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/auto-map.html
ваша помощь будет принята с благодарностью:)