# Elasticsearch response without the field list

**URL:** <https://discuss.elastic.co/t/elasticsearch-response-without-the-field-list/24818>\
**Category:** Elasticsearch\
**Created:** [July 2, 2015, 4:53pm UTC](https://discuss.elastic.co/t/elasticsearch-response-without-the-field-list/24818 "2015-07-02T16:53:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicandp](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@vicandp](https://discuss.elastic.co/u/vicandp)\
**Post date:** [July 2, 2015, 4:53pm UTC](https://discuss.elastic.co/t/elasticsearch-response-without-the-field-list/24818/1 "2015-07-02T16:53:06Z")

</div>

hello

I'm starting with elasticsearch, and use the instructions on how to access and create a java client. Marvel made a consultation with the next code:

```
GET consolidacion/store/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "data.package_field": "0.D.42.17"
          }
        }
      ]
    }
  }
  
}

```

and I get

```
{
   "took": 8,
   "timed_out": false,
   "_shards": {
      "total": 10,
      "successful": 10,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 9.14017,
      "hits": [
         {
            "_index": "consolidacion",
            "_type": "store",
            "_id": "ee24f357c51456ebb84be4897c128bc4",
            "_score": 9.14017,
            "_source": {
               "transaction_uuid": "33fdfa63-f4be-8a27-52f5-d247871a4d71",
               "order": 7,
               "hash": "ee24f357c51456ebb84be4897c128bc4",
               "application_uuid": "477e9531-0a22-4da2-8777-27c7be176ebc",
               "repository_uuid": "275f7132-d82f-11e4-8188-000c29cd",
               "user": null,
               "data": {
                  "package_field": "0.D.42.17",
                  "package": "0.D.42",
                  "nro_registro": 0,
                  "value": "BERTULFO",
                  "package_field_key": "0.D.42.26",
                  "package_field_key_value": "415400"
               },
               "log_date": "2015-06-30T16:27:09-05:00",
               "organization_uuid": "bb0561c3-d911-11e4-8188-000c29cd54dc",
               "provider": "191100000501",
               "person_identifiers": [
                  {
                     "identifier": "bec8ea50-1f6e-11e5-9254-000c29ea4ee7",
                     "domain_name": "ECID"
                  },
                  {
                     "identifier": "415400",
                     "domain_name": "CODPERSON:275f7132-d82f-11e4-8188-000c29cd"
                  }
               ]
            }
         }
      ]
   }
}

```

Java I have the following.

```
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "sitis").put("node.name", "sitis-n1").build();
    
Client esclient = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("172.16.1.202", 9300));

```

We perform validation checking index, and passes without problem.

```
final IndicesExistsResponse res = esclient.admin().indices().prepareExists(indexName).execute().actionGet();

```

Then I pass the query, and see if I return the ID, but does not give me fields and I do not understand why it happens this  
way.

```
String keyField="data.package_field";
String keyValue="0.D.42.17";
String queryString="{\"query\": {\"bool\": {\"must\": [{\"match\": {\""+keyField+"\": \""+keyValue+"\" } }] } } }";

 //Sample Query - JSONObject
 //We convert the raw query string to JSONObject to avoid query parser error in Elasticsearch
  JSONObject queryStringObject = new JSONObject(queryString);

        //Elasticsearch Response
SearchResponse response = esclient.prepareSearch(indexName).setTypes(typeName).setSource(queryStringObject.toString()).execute().actionGet();

//Elasticsearch Response Hits
SearchHits hits = response.getHits();

```

This pom dependencies

```
<dependencies>
		<!-- add the Shield jar as a dependency -->
		<dependency>
			<groupId>org.elasticsearch</groupId>
			<artifactId>elasticsearch-shield</artifactId>
			<version>1.3.0</version>
		</dependency>
		<!-- add the License jar as a dependency -->
		<dependency>
			<groupId>org.elasticsearch</groupId>
			<artifactId>elasticsearch-license-plugin</artifactId>
			<version>1.0.0</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20140107</version>
		</dependency>
	</dependencies>

	<repositories>
		<!-- add the elasticsearch repo -->
		<repository>
			<id>elasticsearch-releases</id>
			<url>http://maven.elasticsearch.org/releases</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>

```

Any idea? and thanks for your valuable collaboration.

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [July 28, 2015, 6:01pm UTC](https://discuss.elastic.co/t/elasticsearch-response-without-the-field-list/24818/2 "2015-07-28T18:01:29Z")

</div>

This post seems better suited for the Elasticsearch category. Relocating it now.

---

<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 5, 2017, 11:58pm UTC](https://discuss.elastic.co/t/elasticsearch-response-without-the-field-list/24818/3 "2017-07-05T23:58:33Z")

</div>


