Question About Dynamic Mappings and Multi-Field-Type

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 http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html

So

  1. Can I set all fields to be Multi-Field-Type?
  2. 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

Have you looked at dynamic mapping?

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

  1. Can I set all fields to be Multi-Field-Type?
  2. 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

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

  1. Can I set all fields to be Multi-Field-Type?
  2. 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

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

  1. Can I set all fields to be Multi-Field-Type?
  2. 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

I mean Double Search Results. Any ideas?

Thanks,
Jason Tesser
dotCMS Director, Support Services
1-305-858-1422

On Thu, Nov 10, 2011 at 1:28 PM, Jason Tesser jasontesser@gmail.com wrote:

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.comwrote:

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

  1. Can I set all fields to be Multi-Field-Type?
  2. 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

OK this all works. Sorry I was confussed about my own content :-p
Not duplicated. Dynamic mappings working.

From Java I called this way for those interested

indicesAdminClient.prepareCreate(indexName)
.addMapping("content", new String(FileUtil.getBytes(new
File(url.getPath()))))
.setSettings(

On Nov 10, 1:29 pm, Jason Tesser jasontes...@gmail.com wrote:

I mean Double Search Results. Any ideas?

Thanks,
Jason Tesser
dotCMS Director, Support Services
1-305-858-1422

On Thu, Nov 10, 2011 at 1:28 PM, Jason Tesser jasontes...@gmail.com wrote:

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 gsf...@gmail.comwrote:

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 gsf...@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 jasontes...@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

  1. Can I set all fields to be Multi-Field-Type?
  2. 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