# Java & ElasticSearch

**URL:** <https://discuss.elastic.co/t/java-elasticsearch/114397>\
**Category:** Elasticsearch\
**Created:** [January 6, 2018, 7:42pm UTC](https://discuss.elastic.co/t/java-elasticsearch/114397 "2018-01-06T19:42:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_Goel](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@Deepak\_Goel](https://discuss.elastic.co/u/Deepak_Goel)\
**Post date:** [January 6, 2018, 7:42pm UTC](https://discuss.elastic.co/t/java-elasticsearch/114397/1 "2018-01-06T19:42:42Z")

</div>

**Hello**

**I uploaded data of "Shakespeare" in ElasticSearch. The data looks like:**

{"index":{"\_index":"shakespeare","\_id":6}}  
{"type":"line","line\_id":7,"play\_name":"Antony","speech\_number":1,"line\_number":"1.1.4","speaker":"KING HENRY IV","text\_entry":"To be commenced in strands afar remote."}

**I am trying to search this data in Java with the following code:**

```
    SearchResponse searchResponse = client.prepareSearch("shakespeare")
            .setTypes("line")
            .setSearchType(SearchType.QUERY_AND_FETCH)
            .setQuery(QueryBuilders.termsQuery("play_name", "Antony"))
            .setFrom(0).setSize(60).setExplain(true)
            .execute()
            .actionGet();

```

**However this query does not return any data. Any clues?**

**Thank You**  
**Deepak**

---

<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:** [January 6, 2018, 9:01pm UTC](https://discuss.elastic.co/t/java-elasticsearch/114397/2 "2018-01-06T21:01:58Z")

</div>

Try with antony instead of Antony

---

<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:** [February 3, 2018, 9:02pm UTC](https://discuss.elastic.co/t/java-elasticsearch/114397/3 "2018-02-03T21:02:06Z")

</div>

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