# Unable to obtain search results with java client

**URL:** https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035
**Category:** Elasticsearch
**Created:** [March 17, 2012, 8:26am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035 "2012-03-17T08:26:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![damien\_Gouyette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_gouyette/32/2956_2.png) [@damien\_Gouyette](https://discuss.elastic.co/u/damien_Gouyette)
#### Post date: [March 17, 2012, 8:26am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/1 "2012-03-17T08:26:14Z")

</div>

Hi everyone,

I'm just discovering elasticsearch this week and i would like to replace in  
my company a DB2 search with elasticsearch capabilities.

I insert 1 million personn in a signe node.

When i user rest api (calling  
[http://localhost:9200/personne/\_search?q=prenom:clarence&pretty=true](http://localhost:9200/personne/_search?q=prenom:clarence&pretty=true) URL) ,  
i obtain the following results :

{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1977,  
"max\_score" : 7.3687563,  
"hits" : [ {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "GGBxRnJVS1mT6SvJxCGmmQ",  
"\_score" : 7.3687563, "\_source" : {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "7oemmrCnSqqNA7FbM7VM1Q",  
"\_score" : 7.3687563, "\_source" : {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "-So1k6tDT0Gnoy3mlG\_KhA",  
"\_score" : 7.3687563, "\_source" : {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "V\_YfrN3tSUmTs0ryXtMFiw",  
"\_score" : 7.3687563, "\_source" : {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "74\_Q17zFRhWCaQR4xdrhtQ",  
"\_score" : 7.3687563, "\_source" : {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "CY8262\_BR3SzA5Eptpk7GA",  
"\_score" : 7.3687563, "\_source" : {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "RdhvKLpYQWulUYoRWSxeuQ",  
"\_score" : 7.3687563, "\_source" : {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}  
}, {  
"\_index" : "personne",  
"\_type" : "personnephysique",  
"\_id" : "kvHP94hMQu-8Ur4sdkFSXQ",  
"\_score" : 7.3687563, "\_source" : {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}  
}, {

...

When i do the same search with java client with the following code :

node = NodeBuilder.nodeBuilder().node();  
Client client = node.client();

```
    SearchResponse response = client.prepareSearch("personne")
            .setSearchType(SearchType.QUERY_AND_FETCH)
            .setQuery(termQuery("prenom", "Clarence"))
            .setFrom(0).setSize(10).setExplain(true)
            .setScroll(new TimeValue(600000))
            .execute()
            .actionGet();

    System.out.println(response.toString());

```

i got 0 result :

{  
"\_scroll\_id" :  
"cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",  
"took" : 17,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" : []  
}  
}

Did i miss something ?  
Thanks for your answer

---

<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: [March 17, 2012, 8:28am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/2 "2012-03-17T08:28:43Z")

</div>

Try Clarence in lower case : clarence

HTH  
David 😉  
@dadoonet

Le 17 mars 2012 à 09:26, damien Gouyette [damien.gouyette@gmail.com](mailto:damien.gouyette@gmail.com) a écrit :

> Hi everyone,
> 
> I'm just discovering elasticsearch this week and i would like to replace in my company a DB2 search with elasticsearch capabilities.
> 
> I insert 1 million personn in a signe node.
> 
> When i user rest api (calling [http://localhost:9200/personne/\_search?q=prenom:clarence&pretty=true](http://localhost:9200/personne/_search?q=prenom:clarence&pretty=true) URL) , i obtain the following results :
> 
> {  
> "took" : 1,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1977,  
> "max\_score" : 7.3687563,  
> "hits" : [ {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "GGBxRnJVS1mT6SvJxCGmmQ",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "7oemmrCnSqqNA7FbM7VM1Q",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "-So1k6tDT0Gnoy3mlG\_KhA",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "V\_YfrN3tSUmTs0ryXtMFiw",  
> "\_score" : 7.3687563, "\_source" : {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "74\_Q17zFRhWCaQR4xdrhtQ",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "CY8262\_BR3SzA5Eptpk7GA",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "RdhvKLpYQWulUYoRWSxeuQ",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}  
> }, {  
> "\_index" : "personne",  
> "\_type" : "personnephysique",  
> "\_id" : "kvHP94hMQu-8Ur4sdkFSXQ",  
> "\_score" : 7.3687563, "\_source" : {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}  
> }, {  
> ...
> 
> When i do the same search with java client with the following code :
> 
> node = NodeBuilder.nodeBuilder().node();  
> Client client = node.client();
> 
> ```
> SearchResponse response = client.prepareSearch("personne")
> .setSearchType(SearchType.QUERY_AND_FETCH)
> .setQuery(termQuery("prenom", "Clarence"))
> .setFrom(0).setSize(10).setExplain(true)
> .setScroll(new TimeValue(600000))
> .execute()
> .actionGet();
> 
> System.out.println(response.toString());
> 
> ```
> 
> i got 0 result :
> 
> {  
> "\_scroll\_id" : "cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",  
> "took" : 17,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 0,  
> "max\_score" : null,  
> "hits" :   
> }  
> }
> 
> Did i miss something ?  
> Thanks for your answer

---

<div class="post-metadata">

### Author: ![damien\_Gouyette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_gouyette/32/2956_2.png) [@damien\_Gouyette](https://discuss.elastic.co/u/damien_Gouyette)
#### Post date: [March 17, 2012, 8:56am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/3 "2012-03-17T08:56:54Z")

</div>

That's it.

I tried a lot pf other things, but not that.  
Thanks for your answer.

Le samedi 17 mars 2012 09:28:43 UTC+1, David Pilato a écrit :

> Try Clarence in lower case : clarence
> 
> HTH  
> David 😉  
> @dadoonet
> 
> > Hi everyone,
> 
> > I'm just discovering elasticsearch this week and i would like to replace  
> > in my company a DB2 search with elasticsearch capabilities.
> > 
> > I insert 1 million personn in a signe node.
> > 
> > When i user rest api (calling  
> > [http://localhost:9200/personne/\_search?q=prenom:clarence&pretty=true](http://localhost:9200/personne/_search?q=prenom:clarence&pretty=true) URL)  
> > , i obtain the following results :
> > 
> > {  
> > "took" : 1,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1977,  
> > "max\_score" : 7.3687563,  
> > "hits" : [ {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "GGBxRnJVS1mT6SvJxCGmmQ",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "7oemmrCnSqqNA7FbM7VM1Q",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "-So1k6tDT0Gnoy3mlG\_KhA",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "V\_YfrN3tSUmTs0ryXtMFiw",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "74\_Q17zFRhWCaQR4xdrhtQ",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "CY8262\_BR3SzA5Eptpk7GA",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "RdhvKLpYQWulUYoRWSxeuQ",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "kvHP94hMQu-8Ur4sdkFSXQ",  
> > "\_score" : 7.3687563, "\_source" :  
> > {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}  
> > }, {  
> > ...
> > 
> > When i do the same search with java client with the following code :
> > 
> > node = NodeBuilder.nodeBuilder().node();  
> > Client client = node.client();
> > 
> > ```
> > SearchResponse response = client.prepareSearch("personne")
> > .setSearchType(SearchType.QUERY_AND_FETCH)
> > .setQuery(termQuery("prenom", "Clarence"))
> > .setFrom(0).setSize(10).setExplain(true)
> > .setScroll(new TimeValue(600000))
> > .execute()
> > .actionGet();
> > 
> > System.out.println(response.toString());
> > 
> > ```
> > 
> > i got 0 result :
> > 
> > {  
> > "\_scroll\_id" :  
> > "cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",  
> > "took" : 17,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 0,  
> > "max\_score" : null,  
> > "hits" :   
> > }  
> > }
> > 
> > Did i miss something ?  
> > Thanks for your answer

---

<div class="post-metadata">

### Author: ![damien\_Gouyette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_gouyette/32/2956_2.png) [@damien\_Gouyette](https://discuss.elastic.co/u/damien_Gouyette)
#### Post date: [March 17, 2012, 9:04am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/4 "2012-03-17T09:04:07Z")

</div>

Not the same comportement between rest api and java api

Clarence in rest = ok  
clarence in rest = ok  
ClArEnCe in rest = ok

clarence in java = ok  
Clarence in java = ko  
ClArEnCe in java = ko

is there a setting parameter to enable case sensitive ?  
Default parameter should be the same between rest and java API

Regards

Damien

Le samedi 17 mars 2012 09:56:54 UTC+1, damien Gouyette a écrit :

> That's it.
> 
> I tried a lot pf other things, but not that.  
> Thanks for your answer.
> 
> Le samedi 17 mars 2012 09:28:43 UTC+1, David Pilato a écrit :
> 
> > Try Clarence in lower case : clarence
> > 
> > HTH  
> > David 😉  
> > @dadoonet
> > 
> > > Hi everyone,
> > 
> > > I'm just discovering elasticsearch this week and i would like to  
> > > replace in my company a DB2 search with elasticsearch capabilities.
> > > 
> > > I insert 1 million personn in a signe node.
> > > 
> > > When i user rest api (calling  
> > > [http://localhost:9200/personne/\_search?q=prenom:clarence&pretty=trueURL](http://localhost:9200/personne/_search?q=prenom:clarence&pretty=trueURL)) , i obtain the following results :
> > > 
> > > {  
> > > "took" : 1,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 1977,  
> > > "max\_score" : 7.3687563,  
> > > "hits" : [ {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "GGBxRnJVS1mT6SvJxCGmmQ",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "7oemmrCnSqqNA7FbM7VM1Q",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "-So1k6tDT0Gnoy3mlG\_KhA",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "V\_YfrN3tSUmTs0ryXtMFiw",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "74\_Q17zFRhWCaQR4xdrhtQ",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "CY8262\_BR3SzA5Eptpk7GA",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "RdhvKLpYQWulUYoRWSxeuQ",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}  
> > > }, {  
> > > "\_index" : "personne",  
> > > "\_type" : "personnephysique",  
> > > "\_id" : "kvHP94hMQu-8Ur4sdkFSXQ",  
> > > "\_score" : 7.3687563, "\_source" :  
> > > {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}  
> > > }, {  
> > > ...
> > > 
> > > When i do the same search with java client with the following code :
> > > 
> > > node = NodeBuilder.nodeBuilder().node();  
> > > Client client = node.client();
> > > 
> > > ```
> > > SearchResponse response = client.prepareSearch("personne")
> > > .setSearchType(SearchType.QUERY_AND_FETCH)
> > > .setQuery(termQuery("prenom", "Clarence"))
> > > .setFrom(0).setSize(10).setExplain(true)
> > > .setScroll(new TimeValue(600000))
> > > .execute()
> > > .actionGet();
> > > 
> > > System.out.println(response.toString());
> > > 
> > > ```
> > > 
> > > i got 0 result :
> > > 
> > > {  
> > > "\_scroll\_id" :  
> > > "cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",  
> > > "took" : 17,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 0,  
> > > "max\_score" : null,  
> > > "hits" :   
> > > }  
> > > }
> > > 
> > > Did i miss something ?  
> > > Thanks for your answer

---

<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: [March 17, 2012, 9:27am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/5 "2012-03-17T09:27:47Z")

</div>

You are not doing exactly the same request.  
In java you asked for a termQuery.  
If think that ?q= is mapped to a textQuery [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html)  
Or a querystring query : [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html)

David 😉  
Twitter : @dadoonet / @elasticsearchfr

Le 17 mars 2012 à 10:04, damien Gouyette [damien.gouyette@gmail.com](mailto:damien.gouyette@gmail.com) a écrit :

> Not the same comportement between rest api and java api
> 
> Clarence in rest = ok  
> clarence in rest = ok  
> ClArEnCe in rest = ok
> 
> clarence in java = ok  
> Clarence in java = ko  
> ClArEnCe in java = ko
> 
> is there a setting parameter to enable case sensitive ?  
> Default parameter should be the same between rest and java API
> 
> Regards
> 
> Damien
> 
> Le samedi 17 mars 2012 09:56:54 UTC+1, damien Gouyette a écrit :  
> That's it.
> 
> I tried a lot pf other things, but not that.  
> Thanks for your answer.
> 
> Le samedi 17 mars 2012 09:28:43 UTC+1, David Pilato a écrit :  
> Try Clarence in lower case : clarence  
> HTH  
> David 😉  
> @dadoonet
> 
> > Hi everyone,
> 
> > I'm just discovering elasticsearch this week and i would like to replace in my company a DB2 search with elasticsearch capabilities.
> > 
> > I insert 1 million personn in a signe node.
> > 
> > When i user rest api (calling [http://localhost:9200/personne/\_search?q=prenom:clarence&pretty=true](http://localhost:9200/personne/_search?q=prenom:clarence&pretty=true) URL) , i obtain the following results :
> > 
> > {  
> > "took" : 1,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1977,  
> > "max\_score" : 7.3687563,  
> > "hits" : [ {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "GGBxRnJVS1mT6SvJxCGmmQ",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "7oemmrCnSqqNA7FbM7VM1Q",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "-So1k6tDT0Gnoy3mlG\_KhA",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "V\_YfrN3tSUmTs0ryXtMFiw",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "74\_Q17zFRhWCaQR4xdrhtQ",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "CY8262\_BR3SzA5Eptpk7GA",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "RdhvKLpYQWulUYoRWSxeuQ",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}  
> > }, {  
> > "\_index" : "personne",  
> > "\_type" : "personnephysique",  
> > "\_id" : "kvHP94hMQu-8Ur4sdkFSXQ",  
> > "\_score" : 7.3687563, "\_source" : {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}  
> > }, {  
> > ...
> > 
> > When i do the same search with java client with the following code :
> > 
> > node = NodeBuilder.nodeBuilder().node();  
> > Client client = node.client();
> > 
> > ```
> > SearchResponse response = client.prepareSearch("personne")
> > .setSearchType(SearchType.QUERY_AND_FETCH)
> > .setQuery(termQuery("prenom", "Clarence"))
> > .setFrom(0).setSize(10).setExplain(true)
> > .setScroll(new TimeValue(600000))
> > .execute()
> > .actionGet();
> > 
> > System.out.println(response.toString());
> > 
> > ```
> > 
> > i got 0 result :
> > 
> > {  
> > "\_scroll\_id" : "cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",  
> > "took" : 17,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 0,  
> > "max\_score" : null,  
> > "hits" :   
> > }  
> > }
> > 
> > Did i miss something ?  
> > Thanks for your answer

---

<div class="post-metadata">

### Author: ![damien\_Gouyette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_gouyette/32/2956_2.png) [@damien\_Gouyette](https://discuss.elastic.co/u/damien_Gouyette)
#### Post date: [March 17, 2012, 9:34am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/6 "2012-03-17T09:34:07Z")

</div>

Thanks for preciseness. I used termquery because it's the default example.

Now let's go to benchmark

See you soon at devoxxfr 😉

---

<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, 3:35am UTC](https://discuss.elastic.co/t/unable-to-obtain-search-results-with-java-client/7035/7 "2017-07-06T03:35:49Z")

</div>


