Java & ElasticSearch


(Deepak Goel) #1

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


(David Pilato) #2

Try with antony instead of Antony


(system) #3

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