2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // docs/update-by-query.asciidoc:662
  2. [source, php]
  3. ----
  4. $params = [
  5. 'index' => 'test',
  6. 'body' => [
  7. 'mappings' => [
  8. 'dynamic' => false,
  9. 'properties' => [
  10. 'text' => [
  11. 'type' => 'text',
  12. ],
  13. ],
  14. ],
  15. ],
  16. ];
  17. $response = $client->indices()->create($params);
  18. $params = [
  19. 'index' => 'test',
  20. 'body' => [
  21. 'text' => 'words words',
  22. 'flag' => 'bar',
  23. ],
  24. ];
  25. $response = $client->index($params);
  26. $params = [
  27. 'index' => 'test',
  28. 'body' => [
  29. 'text' => 'words words',
  30. 'flag' => 'foo',
  31. ],
  32. ];
  33. $response = $client->index($params);
  34. $params = [
  35. 'index' => 'test',
  36. 'body' => [
  37. 'properties' => [
  38. 'text' => [
  39. 'type' => 'text',
  40. ],
  41. 'flag' => [
  42. 'type' => 'text',
  43. 'analyzer' => 'keyword',
  44. ],
  45. ],
  46. ],
  47. ];
  48. $response = $client->indices()->putMapping($params);
  49. ----