0

I am trying to create an ElasticSearch mapping to index an Email. I've read the ES documentation regarding mapping relationships. However I am confused as to what to use to represent recipients?

The ES documentation gives Strong warning to use Parent-Child relationship ONLY when it is really needed and all other options are exhausted. In particular it says to use Parent-Child relationship for a case when there are a few parent with many children.

Most emails have few recipients (less than 50) so my first instinct was to use "Nested-Object". However once in a while there are those.. "all hands" email where the recipients could go up as many as thousands of recipients.

So my dilemma is - my general case seems ideal for Nested-Object, however my edge case seems ideal for Parent-Child relationship. So if there is an experience ElasticSearch users out there that have been through this, I would love to know what mapping relationship you used for this and the reasoning too.

===More Details===

I won't be updating much, just indexing for search.

Each entry represent an email

Each email contains recipients

I would like to be able to retrieve email by searching for recipients.

Each recipients have displayName and emailAddress, and I would like to have this relation intact.

So for example:

{
  "Subject" : "my first email", 
  "Sender"  : {
    "DisplayName" : "Sender Doe", 
    "EmailAddress" : "Sender.Doe@TheCompany.com"
  },
  "Recipient" : {[
    {
      "DisplayName" : "John Who",
      "EmailAddress" : "john.who@hisCompany.com" 
    },
    {
      "DisplayName" : "Jane Doe",
      "EmailAddress" : "jane.doe@hisCompany.com"   
    }   
  ]}
}

In the example above if I were to search for emails where the recipients name contains "John" and "Doe" then the email above will not match.

So right off the bat, I felt nested-object is the correct scheme for this. However sometimes I get an "all-hands" meeting email which is essentially sent to everyone in the company (tens of thousands of recipients).

The limit on fields by default is 1000, which is why I am afraid that nested-object may not be able to handle this.

Here is a link to the default limitation of nested-object index.mapping.total_fields.limit https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html#mapping-limit-settings

BonitoFlakes
  • 69
  • 1
  • 7
  • It all depends on what you want to do with that field and how you want to query it afterwards. Please explain your use case and show some example. – Val Jan 29 '17 at 06:01
  • Hi Val, thank you for your comment. I have edit the original message with more details. Hopefully it would clarify my intent. – BonitoFlakes Jan 29 '17 at 20:06

0 Answers0