# Basic fuzzy query is broken after bulk document indexing?

**URL:** <https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904>\
**Category:** Elasticsearch\
**Created:** [November 17, 2011, 6:24pm UTC](https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904 "2011-11-17T18:24:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![canuck3141](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/canuck3141/32/3071_2.png) [@canuck3141](https://discuss.elastic.co/u/canuck3141)\
**Post date:** [November 17, 2011, 6:24pm UTC](https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904/1 "2011-11-17T18:24:03Z")

</div>

Hi,

I can't get fuzzy search to work and I'm not sure if it's a bug in ElasticSearch or a bug in my understanding of its syntax.

I do the following:

curl -XPUT "[http://localhost:9200/test?pretty=true](http://localhost:9200/test?pretty=true)" -d '  
{  
"mappings" : {  
"member" : {  
"properties" : { "first\_name" : { "type" : "string" }, "last\_name" : { "type" : "string" } }  
}  
}  
}  
'

Returns 200, success!

Then I bulk-insert some members:

curl -XPOST "[http://localhost:9200/\_bulk?pretty=true](http://localhost:9200/_bulk?pretty=true)" -d '  
{"index" : {"\_index" : "test", "\_type" : "member"}}  
{ "first\_name" : "Robert", "last\_name" : "Johnson" }  
{"index" : {"\_index" : "test", "\_type" : "member"}}  
{ "first\_name" : "Elvis", "last\_name" : "Presley" }  
'

Returns 200, success!

Now I can do a simple search and it works fine:

curl "[http://localhost:9200/test/member/\_search?pretty=true&q=robert](http://localhost:9200/test/member/_search?pretty=true&q=robert)"

Returns 200 success and body:

{  
"took" : 9,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.13561106,  
"hits" : [ {  
"\_index" : "test",  
"\_type" : "member",  
"\_id" : "qhwVNX6PTNupID0jl07Vzw",  
"\_score" : 0.13561106, "\_source" : { "first\_name" : "Robert", "last\_name" : "Johnson" }  
} ]  
}  
}

BUT FUZZY SEARCH ALWAYS FAILS:

curl -XGET "[http://localhost:9200/test/member/\_search?pretty=true](http://localhost:9200/test/member/_search?pretty=true)" -d '  
{  
"query" : {  
"fuzzy" : { "first\_name" : "Robart" }  
}  
}  
'

Returns 500, failure:

{  
"error" : "ActionRequestValidationException[Validation Failed: 1: search source is missing;]",  
"status" : 500  
}

What does "search source is missing" mean?

How can I make a basic fuzzy search work? I don't want to use the '~', I want to use "fuzzy" and I am following the guide here [http://www.elasticsearch.org/guide/reference/query-dsl/fuzzy-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/fuzzy-query.html) but it doesn't seem to work.

Am I just totally misunderstanding the syntax for specifying the fuzzy query or what?

Any help is hugely appreciated!

Thanks.

---

<div class="post-metadata">

**Author:** ![canuck3141](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/canuck3141/32/3071_2.png) [@canuck3141](https://discuss.elastic.co/u/canuck3141)\
**Post date:** [November 18, 2011, 10:00am UTC](https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904/2 "2011-11-18T10:00:05Z")

</div>

Anybody? Any ideas?

---

<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:** [November 20, 2011, 8:25am UTC](https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904/3 "2011-11-20T08:25:14Z")

</div>

The failure means that for some reason the search body request did not pass  
to elasticsearch.

On Thu, Nov 17, 2011 at 8:24 PM, canuck3141 [canuck3141@gmail.com](mailto:canuck3141@gmail.com) wrote:

> Hi,
> 
> I can't get fuzzy search to work and I'm not sure if it's a bug in  
> Elasticsearch or a bug in my understanding of its syntax.
> 
> I do the following:
> 
> curl -XPUT "[http://localhost:9200/test?pretty=true](http://localhost:9200/test?pretty=true)" -d '  
> {  
> "mappings" : {  
> "member" : {  
> "properties" : { "first\_name" : { "type" : "string" }, "last\_name" :  
> { "type" : "string" } }  
> }  
> }  
> }  
> '
> 
> Returns 200, success!
> 
> Then I bulk-insert some members:
> 
> curl -XPOST "[http://localhost:9200/\_bulk?pretty=true](http://localhost:9200/_bulk?pretty=true)" -d '  
> {"index" : {"\_index" : "test", "\_type" : "member"}}  
> { "first\_name" : "Robert", "last\_name" : "Johnson" }  
> {"index" : {"\_index" : "test", "\_type" : "member"}}  
> { "first\_name" : "Elvis", "last\_name" : "Presley" }  
> '
> 
> Returns 200, success!
> 
> Now I can do a simple search and it works fine:
> 
> curl "[http://localhost:9200/test/member/\_search?pretty=true&q=robert](http://localhost:9200/test/member/_search?pretty=true&q=robert)"
> 
> Returns 200 success and body:
> 
> {  
> "took" : 9,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 0.13561106,  
> "hits" : [ {  
> "\_index" : "test",  
> "\_type" : "member",  
> "\_id" : "qhwVNX6PTNupID0jl07Vzw",  
> "\_score" : 0.13561106, "\_source" : { "first\_name" : "Robert",  
> "last\_name" : "Johnson" }  
> } ]  
> }  
> }
> 
> BUT FUZZY SEARCH ALWAYS FAILS:
> 
> curl -XGET "[http://localhost:9200/test/member/\_search?pretty=true](http://localhost:9200/test/member/_search?pretty=true)" -d '  
> {  
> "query" : {  
> "fuzzy" : { "first\_name" : "Robart" }  
> }  
> }  
> '
> 
> Returns 500, failure:
> 
> {  
> "error" : "ActionRequestValidationException[Validation Failed: 1: search  
> source is missing;]",  
> "status" : 500  
> }
> 
> What does "search source is missing" mean?
> 
> How can I make a basic fuzzy search work? I don't want to use the '~', I  
> want to use "fuzzy" and I am following the guide here  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/fuzzy-query.htmlbut)  
> it doesn't seem to work.
> 
> Am I just totally misunderstanding the syntax for specifying the fuzzy  
> query  
> or what?
> 
> Any help is hugely appreciated!
> 
> Thanks.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Basic-fuzzy-query-is-broken-after-bulk-document-indexing-tp3516614p3516614.html](http://elasticsearch-users.115913.n3.nabble.com/Basic-fuzzy-query-is-broken-after-bulk-document-indexing-tp3516614p3516614.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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:48am UTC](https://discuss.elastic.co/t/basic-fuzzy-query-is-broken-after-bulk-document-indexing/5904/4 "2017-07-06T03:48:08Z")

</div>


