1

I'm using ElasticaBundle and ElasticSearch with Symfony2 in a system I've written. A 'person' can have many 'positions' in their work history. The positions are sorted by date desc, and in order to find someone's current position with PHP I retrieve and read the first object in the array.

I am struggling to search only the current or first position using ElasticSearch. I have set the mappings upas nested, and I am able to perform a Nested Query returning a 'person' who has a 'position' that matches all my criteria. What I can't do is work out how to only search for the criteria in the 1st listed 'position'. Does anyone have any ideas to set me off on the right path?

The only options I can think of at the moment are: maintain an order value in each object so I can pick out the 1st, or create another field in the entity that only has a relationship, with the 1st position

4

1 回答 1

-1

我在 ElasticSearch 文档中读到 ElasticSearch 不支持这种键,但现在我找不到有问题的页面。对不起。

最后,我通过在当前位置上设置一个标识符来解决这个问题,即给它一个标识符0,所有其他位置编号按顺序排列。

于 2014-12-10T03:24:47.133 回答