Git Product home page Git Product logo

Comments (8)

alekitto avatar alekitto commented on September 15, 2024

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.

Mislop avatar Mislop commented on September 15, 2024

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.

alekitto avatar alekitto commented on September 15, 2024

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.

Mislop avatar Mislop commented on September 15, 2024

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.

Mislop avatar Mislop commented on September 15, 2024

My aggregation :

public static $AGGREGATIONS : [
'term' =>
'category' => 'accessoryCategory.parent.parent.name',
'subCategory' => 'accessoryCategory.parent.name',
'subsubCategory' => 'accessoryCategory.name'
]
];

from fazlandelasticabundle.

alekitto avatar alekitto commented on September 15, 2024

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.

Mislop avatar Mislop commented on September 15, 2024

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.

alekitto avatar alekitto commented on September 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.