Big mapping example?


(Tarjei Huse) #1

Hi, is there a lagre(ish) example of an indexmapping somewhere in the ES
docs? I'm just starting to dip my toes into ES now.

I'm asking because it would be great to have a document like that to begin
using ES - just like Solr has a large commented solrconfig.xml and
schema.xml file that may be used as a startingpoint for setting it up.

Regards,
Tarjei


(Vladimir Shkurin) #2

Yes, lots of examples (especially not the standard :slight_smile: would be cool!

Maybe it can help you, here are some examples:

http://www.elasticsearch.org/guide/reference/mapping/core-types.html

http://www.elasticsearch.org/guide/reference/index-modules/analysis/custom-analyzer.html


(Tarjei Huse) #3

Great!

Thanks.

As I understand it, when you index a document in ES you can either define a
fields properties (in the mapping) when creating the index, but also when
you index the document, am I correct?

What happens if the two field definitions conflict?

Regards,
Tarjei


(Vladimir Shkurin) #4

On the first your question.

  1. You define the settings of the index (analyzers, filters,
    tokenizers)
  2. You define the mappings. Here you can specify many options, field
    name, field type, use an index or not, what fields to use your
    analyzers (index_analyzer, search_analyzer), see the documentation
    "Mapping -> Types -> core".
  3. Put your data, example:

{
"tweet" {
"user" : "kimchy"
"message" : "This is a tweet!",
"postDate" : "2009-11-15T14:12:12",
"retweets" : 4,
}
}

The search should work :slight_smile:

On the second your question I don't know, I use ElasticSearch only the
third day :slight_smile:


(Shay Banon) #5

Mappings can be explicitly defined when you create an index, or use the put
mapping API. If you don't specify it, then automatic mappings will be
created based on the field indexed (for example, if its a number, then it
will be indexed as one).

On Wed, Jul 27, 2011 at 4:01 PM, Tarjei Huse tarjei.huse@gmail.com wrote:

Great!

Thanks.

As I understand it, when you index a document in ES you can either define a
fields properties (in the mapping) when creating the index, but also when
you index the document, am I correct?

What happens if the two field definitions conflict?

Regards,
Tarjei


(system) #6