# JSON wildcard search

**URL:** https://discuss.elastic.co/t/json-wildcard-search/3472
**Category:** Elasticsearch
**Created:** [October 25, 2010, 2:19pm UTC](https://discuss.elastic.co/t/json-wildcard-search/3472 "2010-10-25T14:19:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Albin\_Stigo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/albin_stigo/32/3227_2.png) [@Albin\_Stigo](https://discuss.elastic.co/u/Albin_Stigo)
#### Post date: [October 25, 2010, 2:19pm UTC](https://discuss.elastic.co/t/json-wildcard-search/3472/1 "2010-10-25T14:19:55Z")

</div>

Hi,

Could anyone point me in the right direction on this one...

JSON request with something similar to this in the body:

{  
"query" : {  
"term" : { "user" : "kim\*" }  
}  
}

as opposed to this similar query-string request:

[http://elastichost/e/e/\_search?q=user:kim](http://elastichost/e/e/_search?q=user:kim)\*

(On a different data set) does not seem to produce the same result...  
What am I missing with regards to the "\*" wildcard?

--Albin

On Mon, Oct 25, 2010 at 4:12 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Is there a chance that it ends up opening and closing connections for each  
> index request? You might run out of file descriptors (sockets) that way.
> 
> On Mon, Oct 25, 2010 at 4:02 PM, Jakub [jakub.wachol@gmail.com](mailto:jakub.wachol@gmail.com) wrote:
> 
> > Thx for answer.
> > 
> > I'm 100% sure it's not PHP memory problem.  
> > PHP setting "memory\_limit" is set to 128M in php.ini file.  
> > Script that break with error "Couldnt connect to host  
> > [123.123.123.123], Elasticsearch down?" use only 20.75 megabytes  
> > So it's not the reason of problem.
> > 
> > Regards  
> > Jakub
> > 
> > On 25 Paź, 12:26, Michiel Eghuizen [michieleghui...@gmail.com](mailto:michieleghui...@gmail.com) wrote:
> > 
> > > This could be a memory problem in PHP itself. So you could findout if  
> > > that's  
> > > the case. Because insert such many items in 1 array for example, will  
> > > also  
> > > need such amount of space of memory.
> > > 
> > > On Mon, Oct 25, 2010 at 12:18 PM, Jakub [jakub.wac...@gmail.com](mailto:jakub.wac...@gmail.com) wrote:
> > > 
> > > > Hi,
> > > 
> > > > I'm using latest elasticsearch release 0.12.0  
> > > > I have problem with insert data to elasticsearch.  
> > > > I'm using "elasticsearch" PHP client to insert data.
> > > 
> > > > Insert data is done in loop.  
> > > > PHP script insert 0 - 10000 entries and reload itself.  
> > > > Next it insert entries from 10000 - 20000. And it reload and start  
> > > > from 30000.  
> > > > Script should works like this to the end. About 190000 entries.
> > > 
> > > > Insert single entry works ok. Problem is that script stops every time  
> > > > after insert 28233 entries.  
> > > > I'm 100% sure it's not problem with inserted data of entry 28233  
> > > > because starting from 10000 it will go thourgh entry 28233 without any  
> > > > problem and will stop on entry 38233. So it always insert only 28233  
> > > > entries.  
> > > > PHP client return error.  
> > > > Couldnt connect to host [123.123.123.123], Elasticsearch down?
> > > 
> > > > (123.123.123.123 - is fake ip address)
> > > 
> > > > This problem don't generate any log entry in log file.  
> > > > Elasticsearch is not down after this problem happen.
> > > 
> > > > Did anyone have same problem?  
> > > > Can anyone help me to find what is the reason of this problem?
> > > 
> > > > Thank You  
> > > > Regards  
> > > > Jakub

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [October 25, 2010, 6:19pm UTC](https://discuss.elastic.co/t/json-wildcard-search/3472/2 "2010-10-25T18:19:08Z")

</div>

Hi,

contrary to query\_string (the query type the q URL parameter maps to) the  
term query is not analyzed, thus in your case it searches for "kim\*" token  
(note, this means it is not performing wildcard query).

[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/term\_query/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/term_query/)

[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/term\_query/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/term_query/)  
Regards,  
Lukas

On Mon, Oct 25, 2010 at 4:19 PM, Albin Stigo [albin.stigo@gmail.com](mailto:albin.stigo@gmail.com) wrote:

> Hi,
> 
> Could anyone point me in the right direction on this one...
> 
> JSON request with something similar to this in the body:
> 
> {  
> "query" : {  
> "term" : { "user" : "kim\*" }  
> }  
> }
> 
> as opposed to this similar query-string request:
> 
> [http://elastichost/e/e/\_search?q=user:kim](http://elastichost/e/e/_search?q=user:kim)\*
> 
> (On a different data set) does not seem to produce the same result...  
> What am I missing with regards to the "\*" wildcard?
> 
> --Albin
> 
> On Mon, Oct 25, 2010 at 4:12 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Is there a chance that it ends up opening and closing connections for  
> > each  
> > index request? You might run out of file descriptors (sockets) that way.
> > 
> > On Mon, Oct 25, 2010 at 4:02 PM, Jakub [jakub.wachol@gmail.com](mailto:jakub.wachol@gmail.com) wrote:
> > 
> > > Thx for answer.
> > > 
> > > I'm 100% sure it's not PHP memory problem.  
> > > PHP setting "memory\_limit" is set to 128M in php.ini file.  
> > > Script that break with error "Couldnt connect to host  
> > > [123.123.123.123], Elasticsearch down?" use only 20.75 megabytes  
> > > So it's not the reason of problem.
> > > 
> > > Regards  
> > > Jakub
> > > 
> > > On 25 Paź, 12:26, Michiel Eghuizen [michieleghui...@gmail.com](mailto:michieleghui...@gmail.com) wrote:
> > > 
> > > > This could be a memory problem in PHP itself. So you could findout if  
> > > > that's  
> > > > the case. Because insert such many items in 1 array for example, will  
> > > > also  
> > > > need such amount of space of memory.
> > > > 
> > > > On Mon, Oct 25, 2010 at 12:18 PM, Jakub [jakub.wac...@gmail.com](mailto:jakub.wac...@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > 
> > > > > I'm using latest elasticsearch release 0.12.0  
> > > > > I have problem with insert data to elasticsearch.  
> > > > > I'm using "elasticsearch" PHP client to insert data.
> > > > 
> > > > > Insert data is done in loop.  
> > > > > PHP script insert 0 - 10000 entries and reload itself.  
> > > > > Next it insert entries from 10000 - 20000. And it reload and start  
> > > > > from 30000.  
> > > > > Script should works like this to the end. About 190000 entries.
> > > > 
> > > > > Insert single entry works ok. Problem is that script stops every  
> > > > > time  
> > > > > after insert 28233 entries.  
> > > > > I'm 100% sure it's not problem with inserted data of entry 28233  
> > > > > because starting from 10000 it will go thourgh entry 28233 without  
> > > > > any  
> > > > > problem and will stop on entry 38233. So it always insert only 28233  
> > > > > entries.  
> > > > > PHP client return error.  
> > > > > Couldnt connect to host [123.123.123.123], Elasticsearch down?
> > > > 
> > > > > (123.123.123.123 - is fake ip address)
> > > > 
> > > > > This problem don't generate any log entry in log file.  
> > > > > Elasticsearch is not down after this problem happen.
> > > > 
> > > > > Did anyone have same problem?  
> > > > > Can anyone help me to find what is the reason of this problem?
> > > > 
> > > > > Thank You  
> > > > > Regards  
> > > > > Jakub

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [October 26, 2010, 10:08pm UTC](https://discuss.elastic.co/t/json-wildcard-search/3472/3 "2010-10-26T22:08:53Z")

</div>

You can use the wildcard query explicitly:  
[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/wildcard\_query/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/wildcard_query/).  
You can also use the field query which accepts a query string that supports  
this format as well:  
[Query DSL | Elasticsearch Guide [8.11] | Elastic](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/field_query/)  
.

-shay.banon

On Mon, Oct 25, 2010 at 8:19 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> Hi,
> 
> contrary to query\_string (the query type the q URL parameter maps to) the  
> term query is not analyzed, thus in your case it searches for "kim\*" token  
> (note, this means it is not performing wildcard query).
> 
> [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/term\_query/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/term_query/)
> 
> [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/term\_query/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/term_query/)  
> Regards,  
> Lukas
> 
> On Mon, Oct 25, 2010 at 4:19 PM, Albin Stigo [albin.stigo@gmail.com](mailto:albin.stigo@gmail.com)wrote:
> 
> > Hi,
> > 
> > Could anyone point me in the right direction on this one...
> > 
> > JSON request with something similar to this in the body:
> > 
> > {  
> > "query" : {  
> > "term" : { "user" : "kim\*" }  
> > }  
> > }
> > 
> > as opposed to this similar query-string request:
> > 
> > [http://elastichost/e/e/\_search?q=user:kim](http://elastichost/e/e/_search?q=user:kim)\*
> > 
> > (On a different data set) does not seem to produce the same result...  
> > What am I missing with regards to the "\*" wildcard?
> > 
> > --Albin
> > 
> > On Mon, Oct 25, 2010 at 4:12 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > Is there a chance that it ends up opening and closing connections for  
> > > each  
> > > index request? You might run out of file descriptors (sockets) that way.
> > > 
> > > On Mon, Oct 25, 2010 at 4:02 PM, Jakub [jakub.wachol@gmail.com](mailto:jakub.wachol@gmail.com) wrote:
> > > 
> > > > Thx for answer.
> > > > 
> > > > I'm 100% sure it's not PHP memory problem.  
> > > > PHP setting "memory\_limit" is set to 128M in php.ini file.  
> > > > Script that break with error "Couldnt connect to host  
> > > > [123.123.123.123], Elasticsearch down?" use only 20.75 megabytes  
> > > > So it's not the reason of problem.
> > > > 
> > > > Regards  
> > > > Jakub
> > > > 
> > > > On 25 Paź, 12:26, Michiel Eghuizen [michieleghui...@gmail.com](mailto:michieleghui...@gmail.com) wrote:
> > > > 
> > > > > This could be a memory problem in PHP itself. So you could findout if  
> > > > > that's  
> > > > > the case. Because insert such many items in 1 array for example, will  
> > > > > also  
> > > > > need such amount of space of memory.
> > > > > 
> > > > > On Mon, Oct 25, 2010 at 12:18 PM, Jakub [jakub.wac...@gmail.com](mailto:jakub.wac...@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi,
> > > > > 
> > > > > > I'm using latest elasticsearch release 0.12.0  
> > > > > > I have problem with insert data to elasticsearch.  
> > > > > > I'm using "elasticsearch" PHP client to insert data.
> > > > > 
> > > > > > Insert data is done in loop.  
> > > > > > PHP script insert 0 - 10000 entries and reload itself.  
> > > > > > Next it insert entries from 10000 - 20000. And it reload and start  
> > > > > > from 30000.  
> > > > > > Script should works like this to the end. About 190000 entries.
> > > > > 
> > > > > > Insert single entry works ok. Problem is that script stops every  
> > > > > > time  
> > > > > > after insert 28233 entries.  
> > > > > > I'm 100% sure it's not problem with inserted data of entry 28233  
> > > > > > because starting from 10000 it will go thourgh entry 28233 without  
> > > > > > any  
> > > > > > problem and will stop on entry 38233. So it always insert only  
> > > > > > 28233  
> > > > > > entries.  
> > > > > > PHP client return error.  
> > > > > > Couldnt connect to host [123.123.123.123], Elasticsearch down?
> > > > > 
> > > > > > (123.123.123.123 - is fake ip address)
> > > > > 
> > > > > > This problem don't generate any log entry in log file.  
> > > > > > Elasticsearch is not down after this problem happen.
> > > > > 
> > > > > > Did anyone have same problem?  
> > > > > > Can anyone help me to find what is the reason of this problem?
> > > > > 
> > > > > > Thank You  
> > > > > > Regards  
> > > > > > Jakub

---

<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, 4:17am UTC](https://discuss.elastic.co/t/json-wildcard-search/3472/4 "2017-07-06T04:17:32Z")

</div>


