Facte Query

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Facte Query

paul
Ned to club facets , i.e i am faceting for sports on multiple fields "menVaritySports" and "womenVaritySports"

result is :

Basketball - 3
Golf - 2
Baseball - 2

It should be Basketball - 2 i.e it should consider one "Basketball" if it comes under both men and women. is it possible to do that way.

Data 1
--------
{"sports":{
   "menVaritySports":[
      "Baseball",
      "Basketball"
   ],
   "womenVaritySports":[
      "Basketball",
      "Golf"
   ]
}
}
Data 2
--------
{"sports":{
   "menVaritySports":[
      "Baseball",
      "Basketball"
   ],
   "womenVaritySports":[
      "Golf"
   ]
}
}

QUERY:
------------
{
   "query":{
      "match_all":{

      }
   },
   "facets":{
      "sports":{
         "terms":{
            "fields":[
               "sports.menVaritySports.facet",
               "sports.womenVaritySports.facet"
            ]
         }
      }
   }
}

MAPPING:
---------------
{
   "mappings":{
      "university":{
         "properties":{
            "sports":{
               "properties":{
                  "menVaritySports":{
                     "type":"multi_field",
                     "fields":{
                        "menVaritySports":{
                           "type":"string"
                        },
                        "facet":{
                           "type":"string",
                           "index":"not_analyzed"
                        }
                     }
                  },
                  "womenVaritySports":{
                     "type":"multi_field",
                     "fields":{
                        "womenVaritySports":{
                           "type":"string"
                        },
                        "facet":{
                           "type":"string",
                           "index":"not_analyzed"
                        }
                     }
                  }
               }
            }
         }
      }
   }
}

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/25916485-4576-47e0-aee0-735cd33ddefb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.