# Ingest plugin - access data, perform request

**URL:** <https://discuss.elastic.co/t/ingest-plugin-access-data-perform-request/87132>\
**Category:** Elasticsearch\
**Created:** [May 25, 2017, 1:33pm UTC](https://discuss.elastic.co/t/ingest-plugin-access-data-perform-request/87132 "2017-05-25T13:33:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TPK](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@TPK](https://discuss.elastic.co/u/TPK)\
**Post date:** [May 25, 2017, 1:33pm UTC](https://discuss.elastic.co/t/ingest-plugin-access-data-perform-request/87132/1 "2017-05-25T13:33:25Z")

</div>

Hi,

I'm writing ingest plugin for elasticsearch. It is going to calculate a diff, between the document being inserted and the latest one in the ES, and save diff as a new field.

So far so good, yet I did not find a way to access the data, not perform any requests.

Plugin signature looks as follow:  
MyPlugin extends Plugin implements IngestPlugin

Am I missing something obvious, is there any way to achieve that?

I am aware of Client, SearchService classes but I did not find a way to get to them (@Inject annotation on Plugin only allows Settings instance to be passed).

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [May 25, 2017, 2:27pm UTC](https://discuss.elastic.co/t/ingest-plugin-access-data-perform-request/87132/2 "2017-05-25T14:27:23Z")

</div>

There is a method in `Plugin` called:

```auto
    public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
                                               ResourceWatcherService resourceWatcherService, ScriptService scriptService,
                                               NamedXContentRegistry xContentRegistry) {

```

You can override this to get a reference to a client

Hope that helps

---

<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:** [June 22, 2017, 2:27pm UTC](https://discuss.elastic.co/t/ingest-plugin-access-data-perform-request/87132/3 "2017-06-22T14:27:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
