I am trying some simple sort on an Elasticsearch 2.3.1 index.
The index mapping contains an object named "user" which has a few embedded keys.. one of them is also called "user". So I tried to search by "user.user". But the search result is not accurate at all. However sort results based on any key which is not inside an embedded object is fine.
What am I missing ?
Part of index mapping:
"mappings": {
"detail": {
"properties": {
...
. ...
"user": {
"properties": {
"department": {
"type": "string",
"index": "not_analyzed"
},
"location": {
"type": "string",
"index": "not_analyzed"
},
"user": {
"type": "string",
"index": "not_analyzed"
},
}
"
Excerpt from the java code:
SearchRequestBuilder requestBuilder = client.prepareSearch().setIndices("ua_sensitive").setTypes("detail") .setFetchSource(new String[]{"eventUid", "timeOfEventMilli", "user.user"}, null) addSort(SortBuilders.fieldSort("user.user").order(SortOrder.ASC));
SearchResponse response = requestBuilder.execute().actionGet();
Thanks
Abhijit