Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. {
  2. "project": {
  3. "properties": {
  4. "id": {
  5. "type": "string",
  6. "index": "not_analyzed"
  7. },
  8. "name": {
  9. "type": "string",
  10. "index": "not_analyzed"
  11. },
  12. "createdOn": {
  13. "type": "date",
  14. "format": "date_hour_minute_second"
  15. },
  16. "lastUpdatedOn": {
  17. "type": "date",
  18. "format": "date_hour_minute_second"
  19. }
  20. }
  21. }
  22. }
  23.  
  24. {
  25. "value": {
  26. "properties": {
  27. "id": {
  28. "type": "string",
  29. "index": "not_analyzed"
  30. },
  31. "projectId": {
  32. "type": "string",
  33. "index": "not_analyzed"
  34. },
  35. "translations": {
  36. "type": "nested",
  37. "index": "not_analyzed"
  38. },
  39. "createdOn": {
  40. "type": "date",
  41. "format": "date_hour_minute_second"
  42. },
  43. "lastUpdatedOn": {
  44. "type": "date",
  45. "format": "date_hour_minute_second"
  46. },
  47. "suggest": {
  48. "type": "completion",
  49. "index_analyzer": "simple",
  50. "search_analyzer": "simple",
  51. "payloads": false
  52. }
  53. }
  54. }
  55. }
  56.  
  57. curl -XPOST http://localhost:9200/MY_APPLICATION/_suggest -d'
  58. {
  59. "suggestions": {
  60. "text": "val",
  61. "completion": {
  62. "field": "suggest",
  63. "size": "10",
  64. "fuzzy": {
  65. "fuzziness": "AUTO"
  66. }
  67. }
  68. }
  69. }'
  70.  
  71. {
  72. "_shards": {
  73. "total": 5,
  74. "successful": 5,
  75. "failed": 0
  76. },
  77. "suggestions": [{
  78. "text": "el",
  79. "offset": 0,
  80. "length": 2,
  81. "options": [{
  82. "text": "value1",
  83. "score": 1.0
  84. }, {
  85. "text": "value2",
  86. "score": 1.0
  87. }, {
  88. "text": "value3",
  89. "score": 1.0
  90. }, {
  91. "text": "value4",
  92. "score": 1.0
  93. }, {
  94. "text": "value5",
  95. "score": 1.0
  96. }, {
  97. "text": "value6",
  98. "score": 1.0
  99. }]
  100. }]
  101. }
  102.  
  103. curl -XPOST http://localhost:9200/MY_APPLICATION/Project2/_suggest -d'
  104. {
  105. "suggestions": {
  106. "text": "val",
  107. "completion": {
  108. "field": "suggest",
  109. "size": "10",
  110. "fuzzy": {
  111. "fuzziness": "AUTO"
  112. }
  113. }
  114. }
  115. }'
  116.  
  117. {
  118. "_shards": {
  119. "total": 5,
  120. "successful": 5,
  121. "failed": 0
  122. },
  123. "suggestions": [{
  124. "text": "val",
  125. "offset": 0,
  126. "length": 2,
  127. "options": [{
  128. "text": "value3",
  129. "score": 1.0
  130. }, {
  131. "text": "value4",
  132. "score": 1.0
  133. }]
  134. }]
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement