Well I used this mapping BUT the problem is I get double results when
Searching now. I added a .org to when I sort.
Any Ideas on the double Mapping
{
"content": {
"dynamic_templates": [
{
"template_1": {
"match": "*",
"mapping": {
"type": "multi_field",
"fields": {
"{name}": {
"type": "{dynamic_type}","index":
"analyzed","store": "yes"
},
"org": {
"type": "{dynamic_type}","index":
"not_analyzed","store": "yes"
}
}
}
}
}
]
}
}
Thanks,
Jason Tesser
dotCMS Director, Support Services
1-305-858-1422
On Thu, Nov 10, 2011 at 12:31 PM, Gabriel Farrell gsf747@gmail.com wrote:
Sorry sent that before I finished. With a dynamic mapping you should
be able to do something like the following:
{
"mappings": {
"default": {
"dynamic_templates": [
{
"base": {
"match": "*_sort",
"mapping": {
"type": "multi_field",
"fields": {
"{name}": {"type": "string"},
"sort": {"type": "string", "analyzer": "sort"}
}
}
}
}
]
}
},
"settings": {
"analysis": {
"analyzer": {
"sort": {
"type": "custom",
"tokenizer": "keyword",
"filter": "lowercase"
}
}
}
}
}
This was the create-index JSON I used to take any field ending in
"_sort" and add a ".sort" multifield for sorting, using a custom
"sort" analyzer. I hope that helps for the Java API -- I've only used
HTTP.
On Thu, Nov 10, 2011 at 12:21 PM, Gabriel Farrell gsf747@gmail.com
wrote:
Have you looked at dynamic mapping?
Elasticsearch Platform — Find real-time answers at scale | Elastic
On Wed, Nov 9, 2011 at 3:53 PM, LORDs_diakonos jasontesser@gmail.com
wrote:
I am having issues sorting because I am using the WhiteSpace Analyzer
and my field data is "Some Title" I get why it does work
<custom:"product.title":
org.elasticsearch.index.field.data.strings.StringFieldDataType
$1@164146a7>]: 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]; }
My question is this. I don't use static mappings but want to use
Multi-Field-Type
Elasticsearch Platform — Find real-time answers at scale | Elastic
So
- Can I set all fields to be Multi-Field-Type?
- Can I when construction the JSON to index somehow let Elasticsearch
now to make this field be Multi-Field-Type?
We have Elasticsearch embedded and use the JavaAPI to interact