Comments (8)
The usage of the _parent
field in this bundle is documented here: https://github.com/fazland/FazlandElasticaBundle/blob/master/Resources/doc/types.md#parent-fields
Please refer to the official ES documentation for more information on how the parent-child relationship works in ElasticSearch
from fazlandelasticabundle.
If i need to get parent in the same entity? For exemple if i have Category1 in my entity Category and Category2 in my entity Category and i need to get Category1 (Parent) and Category2 (child) ? This is my problem
from fazlandelasticabundle.
Sorry, can't understand your problem. Can't you just map the parent from the child entity via its property (specifying the same type in the _parent
mapping)?
from fazlandelasticabundle.
For example :
I have entity book, in this entity i have association with category. In my entity category i can get parent with method. In my mapping (config.yml) i have this :
book:
mappings:
name: ~
bookCategory: { type: 'object', properties: { id : {type: 'integer'}, name: {type: 'string', index: 'not_analyzed'}, parent: {type: 'object', properties: {name: {type: 'string', index: 'not_analyzed'}, parent: {type: 'object', properties: {name: {type: 'string', index: 'not_analyzed'}}}}} } }
persistence:
driver: 'orm'
model: 'AppBundle\Entity\Book\Book'
provider:
batch_size: 5000
listener: ~
finder: ~
I get my categories but separately.
category : [key,count]
subCategory: [key, count]
subsubCategory: [key, count]
i need this :
category : [key, count, subCategory [ key, count, subsubCategory [ key, count]]]
Thanks,
from fazlandelasticabundle.
My aggregation :
public static $AGGREGATIONS : [
'term' =>
'category' => 'accessoryCategory.parent.parent.name',
'subCategory' => 'accessoryCategory.parent.name',
'subsubCategory' => 'accessoryCategory.name'
]
];
from fazlandelasticabundle.
What you need can't be done in elasticsearch with parent-child relationship.
With your mapping, to get
category : [key, count, subCategory [ key, count, subsubCategory [ key, count]]]
you just need nested aggregations
from fazlandelasticabundle.
My mapping is good?
My problem is just my aggregations ?
What is path to get this ? :
'category : [key, count, subCategory [ key, count, subsubCategory [ key, count]]]' ?
In public static $AGGREGATIONS : [
'term' =>
'category' => 'accessoryCategory.parent.parent.name',
'subCategory' => 'accessoryCategory.parent.name',
'subsubCategory' => 'accessoryCategory.name'
]
];
How subCategory know it is in 'category' ?
(Sorry for my bad english)
What is path in nested aggregation?
And whats is function addParam? The documentation does not explain
from fazlandelasticabundle.
Excuse me, but this is not a support forum for elasticsearch.
Please refer to the official documentation on how to model your mapping and how to use aggregations, or post a question on StackOverflow, ES dedicated Google groups or other support forum.
from fazlandelasticabundle.
Related Issues (9)
- Create release tag HOT 6
- Index Manager Update API HOT 3
- Elasticsearch 5.x support HOT 1
- test
- Incompatible declaration in Fazland\ElasticaBundle\Elastica\Client:16 HOT 2
- Unrecognized options "groups, serialize_null" under "fazland_elastica.serializer" HOT 1
- Attempted to call an undefined method named "hasFacets" of class "Elastica\ResultSet". HOT 3
- Drop support for sf < 2.7 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fazlandelasticabundle.