What happen if you try:

"mappings": {
"people": {
"properties": {
"work_email": {
"type": "string",
"index_name": "email",
"fields": {
"raw": {
"type": "string",
"index_name": "email.raw",
"index": "not_analyzed"
}
}
}
}
}
}
}'

Does this work?

David

> Le 12 déc. 2014 à 01:12, Dave Reed <[email protected]> a écrit :
> 
> I ran into this problem, and discovered this StackOverflow post (with no 
> answer):
> http://stackoverflow.com/questions/23348172/elasticsearch-index-name-with-multi-field
> 
> That original poster included a gist that reproduces it quite nicely 
> (confirmed on 1.4.1):
> https://gist.github.com/pmishev/11375297
> 
> Partially replicated here for convenience (see the link for full curl steps 
> to reproduce):
> 
> # Create mapping
> curl -XPOST localhost:9200/index1/ -d '{
>   "mappings": {
>      "people": {
>         "properties": {
>            "work_email": {
>               "type": "string",
>               "index_name": "email",
>               "fields": {
>                  "raw": {
>                     "type": "string",
>                     "index": "not_analyzed"
>                  }
>               }
>            }
>         }
>      }
>   }
> }'
> 
> 
> Basically, I have an analyzed string field and a non-analyzed version of it 
> so that I can sort by it. But instead of sorting by "field.sort" or 
> "field.raw", I need to use "field_sort", basically for back compat reasons. 
> To accomplish that I tried giving the non-analyzed sortable version of the 
> string field an index_name. But trying to sort using the given index_name 
> results in an error: "No mapping found for [field_sort] in order to sort on".
> 
> The gist referenced above is slightly different than I am explaining, because 
> it puts the "index_name" on the parent field instead of the sorted part, but 
> the result is the same.
> 
> To put it simply, it seems that you cannot sort by a field by its index_name, 
> you have to use the full path to it, which is a problem for me. Is this 
> expected? Why should I be able to search for a field by its index_name but 
> not sort by it -- that seems unintended. Am I doing it wrong? Is there a 
> better way to accomplish the same thing?
> 
> Thanks for the help!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/af25ab54-407b-4e58-95ea-94c12fb3fb65%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3887D2C8-924B-40C5-94E0-5CFEEA98436A%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to