Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. {
  2. _index: "bla_bla",
  3. .
  4. .
  5. .
  6. _source: {
  7. domain: "somedomain.extension",
  8. path: "/you/know/the/path",
  9. lang: "en",
  10. keywords: ["yeah", "you", "rock", "dude", "help", "me", "good", "samaritan"]
  11. }
  12. }
  13.  
  14. {
  15. "query": {
  16. "filtered": {
  17. "filter": {
  18. "bool": {
  19. "should": {
  20. "terms": {
  21. "keywords": ["stackoverflow", "rocks", "!"]
  22. }
  23. },
  24. "must_not": {
  25. "term": {
  26. "path": "/"
  27. // This works, i.e -> "lang": "en"
  28. }
  29. }
  30. }
  31. }
  32. }
  33. },
  34. "from": 0,
  35. "size": 9
  36. }
  37.  
  38. {
  39. "query": {
  40. "filtered": {
  41. "filter": {
  42. "and": [
  43. {
  44. "bool": {
  45. "should": {
  46. "terms": {
  47. "keywords": [
  48. "stackoverflow",
  49. "rocks",
  50. "!"
  51. ]
  52. }
  53. }
  54. }
  55. },
  56. {
  57. "filter": {
  58. "regexp": {
  59. "path": ".{1,}"
  60. }
  61. }
  62. }
  63. ]
  64. }
  65. }
  66. },
  67. "from": 0,
  68. "size": 9
  69. }
  70.  
  71. PUT /index1/test/_mapping
  72. {
  73. "test" : {
  74. "properties" : {
  75. "message" : {"type" : "string"},
  76. "path" : {"type" : "string", "index" : "not_analyzed"}
  77. }
  78. }
  79. }
  80.  
  81. POST index1/test
  82. {
  83. "path" : "/foo/bar"
  84. }
  85.  
  86. GET index1/test/_search
  87. {
  88. "query": {
  89. "filtered": {
  90. "filter": {
  91. "term": {
  92. "path": "/foo/bar"
  93. }
  94. }
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement