# Define a callback to fetch results if none found

**URL:** <https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266>\
**Category:** Elasticsearch\
**Created:** [August 28, 2011, 6:22am UTC](https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266 "2011-08-28T06:22:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Grebs](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@Christopher\_Grebs](https://discuss.elastic.co/u/Christopher_Grebs)\
**Post date:** [August 28, 2011, 6:22am UTC](https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266/1 "2011-08-28T06:22:20Z")

</div>

Hey there,

I am working on a web service that fetches data from various web  
services and implements on top of them one common API and other  
things. Next to fetching data I also aggregate data from various  
places and now I am wondering if there is some mode or way to tell  
elasticsearch "Call this url if you find nothing" - this callback  
would be some service of mine that returns data exactly the way  
elasticsearch does.

So that it queries the callback exactly the way it would query another  
node (afair this is done with REST too, isn't it?) but the callback  
returns some other aggregated data.

Are there some way to achieve this?

Regards,  
Christopher.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 29, 2011, 5:56pm UTC](https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266/2 "2011-08-29T17:56:26Z")

</div>

Not within elasticsearch. You could potentially write a plugin that does  
that, expose your own REST endpoint (assuming you only care about REST)  
which works in a similar manner to the search endpoint, and goes and fetches  
the relevant data.

Personally, I don't think that such logic belongs in elasticsearch.

On Sun, Aug 28, 2011 at 9:22 AM, Christopher Grebs [cgrebs@googlemail.com](mailto:cgrebs@googlemail.com)wrote:

> Hey there,
> 
> I am working on a web service that fetches data from various web  
> services and implements on top of them one common API and other  
> things. Next to fetching data I also aggregate data from various  
> places and now I am wondering if there is some mode or way to tell  
> elasticsearch "Call this url if you find nothing" - this callback  
> would be some service of mine that returns data exactly the way  
> elasticsearch does.
> 
> So that it queries the callback exactly the way it would query another  
> node (afair this is done with REST too, isn't it?) but the callback  
> returns some other aggregated data.
> 
> Are there some way to achieve this?
> 
> Regards,  
> Christopher.

---

<div class="post-metadata">

**Author:** ![Christopher\_Grebs](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@Christopher\_Grebs](https://discuss.elastic.co/u/Christopher_Grebs)\
**Post date:** [August 29, 2011, 6:44pm UTC](https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266/3 "2011-08-29T18:44:15Z")

</div>

Yea, I don't think either that this belongs to Elasticsearch but I  
always think that if I already can use some cool cluster management  
like ES has I could reuse it.

I guess I need to write such a wrapper myself then. But thanks nevertheless.

Regards,  
Christopher.

On Mon, Aug 29, 2011 at 7:56 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Not within elasticsearch. You could potentially write a plugin that does  
> that, expose your own REST endpoint (assuming you only care about REST)  
> which works in a similar manner to the search endpoint, and goes and fetches  
> the relevant data.  
> Personally, I don't think that such logic belongs in elasticsearch.
> 
> On Sun, Aug 28, 2011 at 9:22 AM, Christopher Grebs [cgrebs@googlemail.com](mailto:cgrebs@googlemail.com)  
> wrote:
> 
> > Hey there,
> > 
> > I am working on a web service that fetches data from various web  
> > services and implements on top of them one common API and other  
> > things. Next to fetching data I also aggregate data from various  
> > places and now I am wondering if there is some mode or way to tell  
> > elasticsearch "Call this url if you find nothing" - this callback  
> > would be some service of mine that returns data exactly the way  
> > elasticsearch does.
> > 
> > So that it queries the callback exactly the way it would query another  
> > node (afair this is done with REST too, isn't it?) but the callback  
> > returns some other aggregated data.
> > 
> > Are there some way to achieve this?
> > 
> > Regards,  
> > Christopher.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:55am UTC](https://discuss.elastic.co/t/define-a-callback-to-fetch-results-if-none-found/5266/4 "2017-07-06T03:55:40Z")

</div>


