Fernando,
Here's what I've learned, based on some excellent help from this newsgroup
and some additional experimentation of my own. Note that I pass the
settings and mappings into the Java API as JSON strings. The trick, I
found, was to get the JSON structure correct.
The full JSON settings and mappings as passed to the
CreateIndexRequestBuilder.setSource(String) method:
{
"settings" : {
"index" : {
"number_of_shards" : 1,
"refresh_interval" : "1s",
"analysis" : {
"char_filter" : { },
"filter" : {
"english_snowball_filter" : {
"type" : "snowball",
"language" : "English"
}
},
"analyzer" : {
"english_stemming_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding",
"english_snowball_filter" ]
},
"english_standard_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding" ]
}
}
}
}
},
"mappings" : {
"ghost" : {
"_all" : {
"enabled" : false
},
"_ttl" : {
"enabled" : true,
"default" : "1.9m"
},
"properties" : {
"cn" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer"
},
"text" : {
"type" : "multi_field",
"fields" : {
"text" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer",
"position_offset_gap" : 4
},
"std" : {
"type" : "string",
"analyzer" : "english_standard_analyzer",
"position_offset_gap" : 4
}
}
}
}
},
"elf" : {
"_all" : {
"enabled" : false
},
"_ttl" : {
"enabled" : true
},
"properties" : {
"cn" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer"
},
"text" : {
"type" : "multi_field",
"fields" : {
"text" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer",
"position_offset_gap" : 4
},
"std" : {
"type" : "string",
"analyzer" : "english_standard_analyzer",
"position_offset_gap" : 4
}
}
}
}
}
}
}
The JSON settings as passed to the UpdateSettingsRequestBuilder.setSettings(String)
method:
{
"index" : {
"refresh_interval" : "1s",
"analysis" : {
"char_filter" : { },
"filter" : {
"english_snowball_filter" : {
"type" : "snowball",
"language" : "English"
}
},
"analyzer" : {
"english_stemming_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding",
"english_snowball_filter" ]
},
"english_standard_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding" ]
}
}
}
}
}
The JSON mapping as passed to the PutMappingRequestBuilder.setSource(String)method for the specified document type name.
{
"elf" : {
"_all" : {
"enabled" : false
},
"_ttl" : {
"enabled" : true
},
"properties" : {
"cn" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer"
},
"text" : {
"type" : "multi_field",
"fields" : {
"text" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer",
"position_offset_gap" : 4
},
"std" : {
"type" : "string",
"analyzer" : "english_standard_analyzer",
"position_offset_gap" : 4
}
}
}
}
}
}
I hope this helps. (Sorry for the delay: The Elasticsearch 0.90 live
webinar took place from noon to 1PM EST, followed by lunch. It was an
excellent presentation!)
On Thursday, May 2, 2013 11:04:30 AM UTC-4, Fernando Javier Martin wrote:
Thanks InquiringMind.
I got what you said but I'm still unable to make it work.
You'll see my current and desired mappings in this gist:
gist:5502715 · GitHub
These are pretty basic indices and not for complex text parsing. As you
can guess these indices will have litttle to nothing text analysis but huge
number of updates and searches.
Anyway, I'm now in doubt if the huge number of records could slow down the
updates and retrieval.
Maybe having completely differente indices like /userdir/user and
/groupdir/group and possibly later /whateverdir/whatever
BTW, I can't find specific documentation on the PUT Mapping API.
This one (
Elasticsearch Platform — Find real-time answers at scale | Elastic)
doesn't provides much information or I'm missing something else.
Could you please give me some guidance on this?
Thanks in advance.
Fernando
--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.