Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nherment
Created April 16, 2012 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nherment/2402313 to your computer and use it in GitHub Desktop.
Save nherment/2402313 to your computer and use it in GitHub Desktop.
ElasticSearch issue
$ curl -XPUT 'http://localhost:9200/system/' -d '{ "settings" : { "index" : {"number_of_replicas" : 1 } } }'
{
"ok": true,
"acknowledged": true
}
$ curl -XPUT 'http://localhost:9200/system/Layout/_mapping' -d '{"Layout":{"properties":{"name":{"type":"string","index":"analyzed","store":"yes"}}}}'
{
"ok": true,
"acknowledged": true
}
$ curl -XPUT 'http://localhost:9200/system/UILayout/_mapping' -d '{"UILayout":{"properties":{"name":{"type":"string","index":"not_analyzed","store":"yes"}}}}'
{
"ok": true,
"acknowledged": true
}
$ curl -XPUT 'http://localhost:9200/system/Layout/main-layout' -d '{"name":"main-layout"}'
{
"ok": true,
"_index": "system",
"_type": "Layout",
"_id": "main-layout",
"_version": 2
}
$ curl -XPOST 'http://localhost:9200/system/UILayout/_search' -d '{"sort":[{"name":"sac"}],"query":{"term": {"name":"foobar"}}}'
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 4,
"failed": 1,
"failures": [
{
"index": "system",
"shard": 2,
"status": 500,
"reason": "QueryPhaseExecutionException[[system][2]: query[filtered(name:foobar)->FilterCacheFilterWrapper(_type:UILayout)],from[0],size[10],sort[<custom:\"name\": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@346df9bc>]: Query Failed [Failed to execute main query]]; nested: IOException[Can't sort on string types with more than one value per doc, or more than one token per field]; "
}
]
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment