# What libraries are needed for spark?

**URL:** https://discuss.elastic.co/t/what-libraries-are-needed-for-spark/48191
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [April 22, 2016, 4:56pm UTC](https://discuss.elastic.co/t/what-libraries-are-needed-for-spark/48191 "2016-04-22T16:56:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![chris\_snow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_snow/32/9363_2.png) [@chris\_snow](https://discuss.elastic.co/u/chris_snow)
#### Post date: [April 22, 2016, 4:56pm UTC](https://discuss.elastic.co/t/what-libraries-are-needed-for-spark/48191/1 "2016-04-22T16:56:24Z")

</div>

I want to be able to read and write to ES from spark. I've created a elasticsearch-hadoop-with-dependencies library but it's 188Mb!

I've stripped out some stuff that I don't think I need - see my gradle configuration below. What else can be removed?

```
dependencies {
    // the elastic search library
    compile('org.elasticsearch:elasticsearch-hadoop:2.3.0') {
        // FIXME: there was an issue zipping up this library so excluding it
        exclude group: 'org.apache.curator', module: 'apache-curator'
    }
}

// create jar file with all dependencies
task('SetupElasticSearchLibs', type: Jar) {
    baseName = 'elastic-search-with-dependencies'
    from {
        configurations.compile.filter( {
                                        !(it.name =~ /spark.*\.jar/ ) &&
                                        !(it.name =~ /jetty-all.*\.jar/ ) &&
                                        !(it.name =~ /servlet-api.*\.jar/ ) &&
                                        !(it.name =~ /pig.*\.jar/ )
                                    }).collect {
            println it
            it.isDirectory() ? it : zipTree(it)
        }
    }
    zip64 = true
    with jar
}
```

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [April 26, 2016, 1:42am UTC](https://discuss.elastic.co/t/what-libraries-are-needed-for-spark/48191/2 "2016-04-26T01:42:46Z")

</div>

es-hadoop by itself doesn't require any libraries - it is designed to reuse the ones available in Hadoop and Spark at runtime. Take a look at the docs or better yet, the POM in particular the dependencies scope (which are `provided`).  
In your case, through gradle, you are getting Hadoop and Spark in your uber jar which is really unnecessary.

---

<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, 1:24pm UTC](https://discuss.elastic.co/t/what-libraries-are-needed-for-spark/48191/3 "2017-07-06T13:24:55Z")

</div>


