Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. #
  2. # Steps to reproduce using sence or kibana dev tools
  3. #
  4.  
  5. PUT /test_index
  6. {
  7. "settings": {
  8. "number_of_shards": 1,
  9. "number_of_replicas": 0
  10. },
  11. "mappings" : {
  12. "file" : {
  13. "properties" : {
  14. "text" : {
  15. "type" : "string",
  16. "analyzer": "danish"
  17. },
  18. "level_two_text" : {
  19. "type": "nested",
  20. "properties": {
  21. "text" : {
  22. "type": "string",
  23. "analyzer": "danish"
  24. }
  25. }
  26. },
  27. "level_three_text": {
  28. "type": "nested",
  29. "properties": {
  30. "level_two": {
  31. "type": "nested",
  32. "properties": {
  33. "text": {
  34. "type": "string",
  35. "analyzer": "danish"
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }
  45.  
  46. # Works as expected
  47. POST /test_index/file
  48. {
  49. "text" : "Text around a name Jensen, Hans and finding the name",
  50. "level_two_text" : {
  51. "text" : "Text around a name Jensen, Anders and finding the name"
  52. },
  53. "level_three_text" : {
  54. "level_two" : {
  55. "text" : "Text around a name Hans Jensen and finding the name"
  56. }
  57. }
  58. }
  59.  
  60. # Works as expected
  61. POST /test_index/file/_search
  62. {
  63. "query": {
  64. "nested": {
  65. "path": "level_two_text",
  66. "query": {
  67. "query_string": {
  68. "default_field": "level_two_text.text",
  69. "query": "\"Jensen, Anders\""
  70. }
  71. },
  72. "inner_hits" : {
  73. "highlight" : {
  74. "fields" : {
  75. "level_two_text.text" : {
  76. "number_of_fragments": 0
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84.  
  85. # Does not work as expected - but works if using the english analyzer instead of the danish
  86. POST /test_index/file/_search
  87. {
  88. "query": {
  89. "nested": {
  90. "path": "level_three_text.level_two",
  91. "query": {
  92. "query_string": {
  93. "default_field": "level_three_text.level_two.text",
  94. "query": "\"Hans Jensen\""
  95. }
  96. },
  97. "inner_hits" : {
  98. "highlight" : {
  99. "fields" : {
  100. "level_three_text.level_two.text" : {
  101. "number_of_fragments": 0
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement