here is my config
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
allstock:
types:
clip:
mappings:
clipInfo:
type: "nested"
properties:
title : { boost: 10 }
description : { boost: 2 }
filterCategories:
type: "nested"
properties:
tags:
type: "nested"
properties:
tag : { boost: 5 }
filterCategory:
type: "nested"
properties:
name: ~
persistence:
driver: orm
model: Application\myBundle\Entity\Clip
provider: ~
listener: ~
finder: ~
and this is my index data
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1.0,
"hits": [
{
"_index": "allstock",
"_type": "clip",
"_id": "11",
"_score": 1.0,
"_source": {
"clipInfo": {
"title": "title 1",
"description": "some desc"
},
"filterCategories": [
{
"tags": [
{
"tag": "Interior"
}
],
"filterCategory": {
"name": "Setting"
}
},
{
"tags": [
{
"tag": "Sunny"
}
],
"filterCategory": {
"name": "Season"
}
}
]
}
},
{
"_index": "allstock",
"_type": "clip",
"_id": "12",
"_score": 1.0,
"_source": {
"clipInfo": {
"title": "title 2",
"description": "desc 2"
},
"filterCategories": [
{
"tags": [
{
"tag": "Sunny"
},
{
"tag": "Rainy"
}
],
"filterCategory": {
"name": "Weather"
}
},
{
"tags": [
{
"tag": "Autumn"
},
{
"tag": "Winter"
}
],
"filterCategory": {
"name": "Season"
}
}
]
}
}
]
}
}
I am trying to build a conditional search on the filterCategories
nested collection
when tag in tags == 'sunny'
then name in filterCategory == 'Weather'
i.e tag
in tags
and name
in filterCategory
dependent on each other value.
How can I achieve this?