Multi_Match with filter by _type


(Garrett Johnson) #1

I have an index created by the JDBC river that contains types of objects:

Orders, Accounts etc.

If I execute the boosted multimatch query below I get back 50 of each type of result. All is well.

However I'm trying to give the option to filter the list by user control and lets say i only want to search one type or ... as many as I want.

I tried using Filtered but couldn't get the syntax to work for me.

Thanks for you help.

{

"query": {

"multi_match": {

  "fields": [

    "Name^5",

    "Id^20",

    "*Name^5",

    "Title^5",

    "Subject^5",

    "Domain^5",

    "_all"

  ],

  "query": "mysearch",

  "type": "best_fields",

  "use_dis_max": "false"

},

},

"from": 0,

"sort": [],

"size": 50,

"aggs": {

"top-types": {

  "terms": {

    "field": "_type"

  },

  "aggs": {

    "top_type_hits": {

      "top_hits": {

        "size": 50

      }

    }

  }

}

}

}


(system) #2