# Add external libraries to elasticsearch

**URL:** <https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845>\
**Category:** Elasticsearch\
**Created:** [June 21, 2019, 9:20am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845 "2019-06-21T09:20:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![MKU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mku/32/48327_2.png) [@MKU](https://discuss.elastic.co/u/MKU)\
**Post date:** [June 21, 2019, 9:20am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/1 "2019-06-21T09:20:26Z")

</div>

I would want to add org.apache.http libraries to the gradle file .how do i do that

thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 21, 2019, 5:19pm UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/2 "2019-06-21T17:19:10Z")

</div>

What for? Where?

---

<div class="post-metadata">

**Author:** ![MKU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mku/32/48327_2.png) [@MKU](https://discuss.elastic.co/u/MKU)\
**Post date:** [June 21, 2019, 5:36pm UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/3 "2019-06-21T17:36:29Z")

</div>

I have added the authentication in RestController.java ,after successful authentication i want to create and send cookie in response header.  
So i need to use org.apache.http libraries.  
is there any other way to send the response header.

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 21, 2019, 7:09pm UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/4 "2019-06-21T19:09:15Z")

</div>

It's in core? In a plugin?

---

<div class="post-metadata">

**Author:** ![MKU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mku/32/48327_2.png) [@MKU](https://discuss.elastic.co/u/MKU)\
**Post date:** [June 22, 2019, 7:20am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/5 "2019-06-22T07:20:50Z")

</div>

core

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 22, 2019, 10:12am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/6 "2019-06-22T10:12:13Z")

</div>

We don't support this. But if I had to add something in core I'd probably add it here:

> <https://github.com/elastic/elasticsearch/blob/master/libs/core/build.gradle#L24-L34>

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [June 22, 2019, 11:54am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/7 "2019-06-22T11:54:47Z")

</div>

Hey @MKU, you've asked a lot of questions over the last several months that strongly suggest you're trying to develop your own security functionality rather than using the one that's already included in Elasticsearch. Security is hard to get right even with a great deal of skill and experience. Also, running a nonstandard and unsupported build of Elasticsearch is likely to cause you serious problems, possibly including data loss, that we won't be able to help you diagnose or fix. Furthermore, you may not have heard, but recently Elastic [upgraded the functionality available with the **free** basic licence to include security](https://www.elastic.co/blog/security-for-elasticsearch-is-now-free). I think you should reconsider the path you're following.

---

<div class="post-metadata">

**Author:** ![MKU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mku/32/48327_2.png) [@MKU](https://discuss.elastic.co/u/MKU)\
**Post date:** [June 24, 2019, 4:59am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/8 "2019-06-24T04:59:47Z")

</div>

Hi @DavidTurner ,  
I was not aware of those things i will definitely check them out.

---

<div class="post-metadata">

**Author:** ![MKU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mku/32/48327_2.png) [@MKU](https://discuss.elastic.co/u/MKU)\
**Post date:** [June 24, 2019, 5:01am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/9 "2019-06-24T05:01:12Z")

</div>

This is my build.gradle now at lib/core.  
dependencies {  
testCompile "com.carrotsearch.randomizedtesting:randomizedtestingrunner:{versions.randomizedrunne}" testCompile "junit:junit:{versions.junit}"  
testCompile "org.hamcrest:hamcrest-all:{versions.hamcrest}" testCompile "org.apache.http.HeaderIterator:{versions.http}"  
testCompile "org.apache.http.HttpResponse:{versions.http}" testCompile "org.apache.http.HttpStatus:{versions.http}"  
testCompile "org.apache.http.HttpVersion:{versions.http}" testCompile "org.apache.http.impl.client.CloseableHttpClient:{versions.http}"  
testCompile "org.apache.http.impl.client.HttpClients:{versions.http}" testCompile "org.apache.http.message.BasicHttpResponse:{versions.http}"

```
if (!isEclipse && !isIdea) {
    java9Compile sourceSets.main.output
}

if (isEclipse == false || project.path == ":libs:core-tests") {
    testCompile("org.elasticsearch.test:framework:${version}") {
        exclude group: 'org.elasticsearch', module: 'elasticsearch-core'
    }
}

```

}  
but it throws mepackage org.apache.http does not exist.  
how do i solve this

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 24, 2019, 5:32am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/10 "2019-06-24T05:32:32Z")

</div>

That's a gradle question not an elasticsearch one.  
You don't include classes in a build but a library. So just include the http client lib.

---

<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 22, 2019, 5:32am UTC](https://discuss.elastic.co/t/add-external-libraries-to-elasticsearch/186845/11 "2019-07-22T05:32:35Z")

</div>

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