You must handle exceptions very carefully in plugins. You should log errors
to the log, skip/disable the plugin operation, and that's it.

Jörg


On Fri, Sep 5, 2014 at 3:14 AM, Srinivasan Ramaswamy <[email protected]>
wrote:

> Hi Joerg,
>
> I tried the data loading part as a separate module and it works, but i
> have a small issue with it. When there is an exception the constructor gets
> called multiple times.
>
> public class CustomDataModule extends AbstractModule {
>     private final Settings settings;
>
>     public SalesDataModule(Settings settings){
>         this.settings = settings;
>     }
>
>     @Override
>     protected void configure() {
>         bind(CustomData.class).asEagerSingleton();
>     }
> }
>
>
> public final class CustomData {
> private static Logger logger = LoggerFactory.getLogger(CustomData.class);
> @Inject
>     public CustomData(Settings settings) {
>     logger.info("CustomData constructor called");
>             WebResource webResource = getDataServiceResource(settings);
>             response = getSalesDataFromDataService(webResource);
>             loadCustomDataIntoMemory(response);
>     }
> }
>
> when the external service (which is the source of data) is down or there
> is some other issue, the CustomData constructor gets called repeatedly
> (approx 400 times). When there is no exception it gets called only once. I
> am trying to understand why its called multiple times when there is an
> exception.
>
> I took a look at your code sample and I am trying to understand the
> purpose of the Build class and who calls it ?
>
> Can you also elaborate on your thoughts about reloading this customData
> periodically. Currently I am thinking of using LoadingCache to store the
> data and refresh it by using the refresh mechanism.
>
> Thanks
> Srini
>
>
> On Tue, Sep 2, 2014 at 2:01 PM, [email protected] <
> [email protected]> wrote:
>
>> Not sure if you looked at the source code of the function score weighted
>> boost plugin. The plugin uses query-time parameterization but it is of
>> course very easy to modify this and use settings at ES node startup time
>> for function score boosting, or a refresh mechanism that fetches parameters
>> from wherever you like.
>>
>> Jörg
>>
>>
>> On Tue, Sep 2, 2014 at 8:09 PM, Srinivasan Ramaswamy <[email protected]>
>> wrote:
>>
>>> Thanks Vineeth. I stumbled upon that example too, thats one of the best
>>> resources I have found so far.
>>>
>>> Thanks Joerg, this example looks very interesting to me. I see that you
>>> are sending in the extra parameters with the query, but i would like the
>>> plugin to read the data from external source and not during scoring time
>>> (in a seperate background thread periodically). I have data for every
>>> document but organized in a multilayered structure. Thats one of the reason
>>> I couldnt put it in the document index and retrieve it efficiently during
>>> scoring. Now I am planning to put it in a in-memory data structure which is
>>> available for the plugin to use. Do you have any thoughts/recommendation on
>>> that ?
>>>
>>> Thanks
>>> Srini
>>>
>>>
>>>
>>>
>>> On Tue, Sep 2, 2014 at 10:16 AM, [email protected] <
>>> [email protected]> wrote:
>>>
>>>> You can write a function score plugin.
>>>>
>>>> Here is an example:
>>>>
>>>> https://github.com/jprante/elasticsearch-functionscore-conditionalboost
>>>>
>>>> Jörg
>>>>
>>>>
>>>>
>>>> On Tue, Sep 2, 2014 at 6:48 PM, Srinivasan Ramaswamy <
>>>> [email protected]> wrote:
>>>>
>>>>> I am trying to write a custom scoring plugin that will let me provide
>>>>> some extra data that is not in the index (through an external service) and
>>>>> do customized ranking. I would ideally like to custom score all the
>>>>> documents in the index that match the query.
>>>>>
>>>>> Currently I am planning to implement it as a service by extending
>>>>> AbstractLifecycleComponent which will periodically pull that extra
>>>>> data from my external service. Is there a better way ? When and how the
>>>>> plugin services will be called. I would like to know in detail about the
>>>>> entry points of plugins and how i should write this plugin. Any help or
>>>>> pointers would be appreciated.
>>>>>
>>>>> Thanks
>>>>> Srini
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "elasticsearch" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>>
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/elasticsearch/dd21c829-867c-47f4-99f0-29465ae1b33d%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/elasticsearch/dd21c829-867c-47f4-99f0-29465ae1b33d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "elasticsearch" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/elasticsearch/qJn1yUQToP0/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEJMueVnRAquoiCMEHBBWGTS1D091v0ArmWK4f6GE2aCA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEJMueVnRAquoiCMEHBBWGTS1D091v0ArmWK4f6GE2aCA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "elasticsearch" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elasticsearch/CAL1MvVw2ZReG-aMUDKzDZrPzHfb6hHMqJOJ4VS3qSsH6DfGFTw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/elasticsearch/CAL1MvVw2ZReG-aMUDKzDZrPzHfb6hHMqJOJ4VS3qSsH6DfGFTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "elasticsearch" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/elasticsearch/qJn1yUQToP0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGmo5MXGVH%2B-NQSEMqzNN0A-GLz7C67C%2BhZNSRHQSFxew%40mail.gmail.com
>> <https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGmo5MXGVH%2B-NQSEMqzNN0A-GLz7C67C%2BhZNSRHQSFxew%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/CAL1MvVybOxcL68vfZ_Lji8bqB20d%3DJYoV9D_DDr4u_qEYQMJ1A%40mail.gmail.com
> <https://groups.google.com/d/msgid/elasticsearch/CAL1MvVybOxcL68vfZ_Lji8bqB20d%3DJYoV9D_DDr4u_qEYQMJ1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEmH9wA-tKUoR-2sibNzGbGOhDPchA5gdO1EKygi_WjfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to