ES 2.0 and boosting a specific types field

Hi!

I'm trying to upgrade from ES 1.7 to 2.4, however I have some questions.

Previously I could boost specific fields from specific types when using a multi_match, like this:

      multi_match:
        {
          query: @query,
          fields: ["*.original^4", "*.stemmed", "*.partial", "tag.name.original^30", "tag.name.lowercased^30",
                   "department.title", "department_title", "colleague.full_name"],
          cutoff_frequency: 0.001
        }

Here I have a bunch of fields that have .original, .stemmed and .partial versions indexed. However, if I get a match on tag.name.original it should be boosted (tags are very important). In 2.0 the feature to use type.field was removed so I can't do it like this anymore.

Is there an alternative approach I can take to get the same functionality?

The only thing I can think of is to index the tag name again, with another name that includes the type in its name, like tag_name.original etc. and use that for the boosting.

Is that the way to go with this?

Somewhat more verbosely:

DELETE test
POST test/doc
{
	"foo":"bar"
}
POST test/doc2
{
	"foo":"bar"
}
GET test/_search
{
   "query": {
	  "bool": {
		 "boost": 10,
		 "should": [
			{
			   "bool": {
				  "boost": 10,
				  "must": [
					 {
						"term": {
						   "_type": "doc"
						}
					 },
					 {
						"match": {
						   "foo": "bar"
						}
					 }
				  ]
			   }
			},
			{
			   "bool": {
				  "boost": 1,
				  "must": [
					 {
						"term": {
						   "_type": "doc2"
						}
					 },
					 {
						"match": {
						   "foo": "bar"
						}
					 }
				  ]
			   }
			}
		 ]
	  }
   }
}

Yuck, that's verbose... I guess I'll just index the field again with a different name and use that. Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.