22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // search/request/sort.asciidoc:289
  2. [source, php]
  3. ----
  4. $params = [
  5. 'body' => [
  6. 'query' => [
  7. 'nested' => [
  8. 'path' => 'parent',
  9. 'query' => [
  10. 'bool' => [
  11. 'must' => [
  12. 'range' => [
  13. 'parent.age' => [
  14. 'gte' => 21,
  15. ],
  16. ],
  17. ],
  18. 'filter' => [
  19. 'nested' => [
  20. 'path' => 'parent.child',
  21. 'query' => [
  22. 'match' => [
  23. 'parent.child.name' => 'matt',
  24. ],
  25. ],
  26. ],
  27. ],
  28. ],
  29. ],
  30. ],
  31. ],
  32. 'sort' => [
  33. [
  34. 'parent.child.age' => [
  35. 'mode' => 'min',
  36. 'order' => 'asc',
  37. 'nested' => [
  38. 'path' => 'parent',
  39. 'filter' => [
  40. 'range' => [
  41. 'parent.age' => [
  42. 'gte' => 21,
  43. ],
  44. ],
  45. ],
  46. 'nested' => [
  47. 'path' => 'parent.child',
  48. 'filter' => [
  49. 'match' => [
  50. 'parent.child.name' => 'matt',
  51. ],
  52. ],
  53. ],
  54. ],
  55. ],
  56. ],
  57. ],
  58. ],
  59. ];
  60. $response = $client->search($params);
  61. ----