导入使用es

from django.shortcuts import render, HttpResponse
from elasticsearch import Elasticsearch
from elasticsearch import helpers
from django.http import JsonResponse
import json
from utils.pagination import Pagination

# Create your views here.

es = Elasticsearch(['127.0.0.1:9200'])
es = Elasticsearch(['127.0.0.1:9200'], ignore=400) # 忽略返回的400状态码
es = Elasticsearch(['127.0.0.1:9200'], ignore=[400, 405, 502]) # 以列表的形式忽略多个状态码
posted @ 2021-10-16 23:55  马昌伟  阅读(8)  评论(0编辑  收藏  举报