Different field boost per type


(Dustin Martin) #1

I have 3 document types in one index. The three document types have some overlapping fields. For instance, type1 and type2 have a 'name' field. For type1.name I want to boost it to 6 but for type2.name I want to boost it to 3. Is there a way to specify the boost fields by type?

For reference, here is a query similar to what I am currently using:

{
  query: {
    bool: {
      filter: {
        or: [
          { type: { value: 'type1' } },
          { type: { value: 'type2' } }
        ]
      },
      must: [
        {
          query_string: {
            fields: ['name^6'],
            query: 'my search string*'
          }
        }
      ]
    }
  }
}

(system) #2