create_index.py 990 B

123456789101112131415161718192021222324252627282930
  1. """
  2. only use when create es index
  3. """
  4. import asyncio
  5. from applications.config import ELASTIC_SEARCH_INDEX, ES_HOSTS, ES_PASSWORD
  6. from applications.utils.elastic_search.client import AsyncElasticSearchClient
  7. settings = {"number_of_shards": 3, "number_of_replicas": 1}
  8. mappings = {
  9. "properties": {
  10. "milvus_id": {"type": "keyword"}, # 向量数据库主键 id
  11. "doc_id": {"type": "keyword"}, # 文档 ID
  12. "chunk_id": {"type": "long"}, # chunk ID
  13. "topic": {"type": "text", "fields": {"keyword": {"type": "keyword"}}}, # 主体
  14. "domain": {"type": "keyword"},
  15. "task_type": {"type": "keyword"},
  16. "text_type": {"type": "keyword"},
  17. "dataset_id": {"type": "keyword"},
  18. "keywords": {"type": "keyword"},
  19. "concepts": {"type": "keyword"},
  20. "entities": {"type": "keyword"},
  21. "status": {"type": "keyword"},
  22. "created_at": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss||epoch_millis"},
  23. }
  24. }