Isn't better to create single document for each mail with fields "subject" and "body" (and whatever else you need from the mail) ? This way you can search by any or all of the fields, also you can define boosting for each field. For instance when your search matches the subject the mail will be scored higher in the result than if it matches the body, and you will get single set of results.
06 август 2014, сряда, 02:12:52 UTC+3, Mark Fletcher написа: > > Hi, > > We're using ES to index email, specifically mailing list messages. We'd > like search to work similar to Gmail in that we'd like to match on either > the subject or body of the email, and if it matches on the subject, we only > want to display one result for that match (say the first message in that > thread). In our naive implementation, we have an ES index for subjects and > another for message bodies. But that gets us two sets of results, not > combined. Is there a better way to structure the data, or a query that > we're missing so that we get one set of combined results? > > Thanks, > Mark > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8bc4cf98-fc1c-408f-8c29-7291afcd3cdf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
