aboutsummaryrefslogtreecommitdiff
path: root/wqflask/mock/es_double.py
blob: 6ef8a1b94a286f73678eb2063ba71af6d80fd000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class ESDouble(object):
    def __init__(self):
        self.items = {}

    def ping(self):
        return true

    def create(self, index, doc_type, body, id):
        self.items["index"] = {doc_type: {"id": id, "_source": data}}

    def search(self, index, doc_type, body):
        return {
            "hits": {
                "hits": self.items[index][doc_type][body]
            }}