def _find_by_id(self, resource, _id, parent=None):
        """Find the document by Id. If parent is not provided then on
        routing exception try to find using search.
        """
        def is_found(hit):
            if 'exists' in hit:
                hit['found'] = hit['exists']
            return hit.get('found', False)

        args = self._es_args(resource)
        try:
            # set the parent if available
            if parent:
                args['parent'] = parent

            hit = self.elastic(resource).get(id=_id, **args)

            if not is_found(hit):
                return

            docs = self._parse_hits({'hits': {'hits': [hit]}}, resource)
            return docs.first()

        except elasticsearch.NotFoundError:
            return
        except elasticsearch.TransportError as tex:
            if tex.error == 'routing_missing_exception' or 'RoutingMissingException' in tex.error:
                # search for the item
                args = self._es_args(resource)
                query = {'query': {'bool': {'must': [{'term': {'_id': _id}}]}}}
                try:
                    args['size'] = 1
                    hits = self.elastic(resource).search(body=query, **args)
                    docs = self._parse_hits(hits, resource)
                    return docs.first()
                except elasticsearch.NotFoundError:
                    return
Find the document by Id. If parent is not provided then on
        routing exception try to find using search.