Advertisement
Guest User

Untitled

a guest
May 16th, 2018
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.30 KB | None | 0 0
  1. PUT compound_test
  2. {
  3.   "settings": {
  4.     "analysis": {
  5.       "filter": {
  6.         "nGram_3": {
  7.           "type": "nGram",
  8.           "min_gram": "3",
  9.           "max_gram": "3"
  10.         }
  11.       },
  12.       "analyzer": {
  13.         "trigrams": {
  14.           "type": "custom",
  15.           "filter": [
  16.             "nGram_3"
  17.           ],
  18.           "tokenizer": "whitespace"
  19.         }
  20.       }
  21.     }
  22.   },
  23.   "mappings": {
  24.     "doc": {
  25.       "properties": {
  26.         "content": {
  27.           "type": "text",
  28.           "analyzer": "trigrams"
  29.         }
  30.       }
  31.     }
  32.   }
  33. }
  34.  
  35. POST /compound_test/doc/_bulk
  36. { "index": { "_id": 1 }}
  37. { "content": "elasticsearch is awesome" }
  38. { "index": { "_id": 2 }}
  39. { "content": "some search queries dont perform good" }
  40.  
  41. # this will return both documents. This is not what I want
  42. GET compound_test/_search
  43. {
  44.   "query": {
  45.     "match": {
  46.       "content": {
  47.         "query": "awesome search",
  48.         "minimum_should_match": "100%"
  49.       }
  50.     }
  51.   }
  52. }
  53.  
  54. # this is what I actually want, without writing it that way / preanalyzing it on client side
  55. GET compound_test/_search
  56. {
  57.   "query": {
  58.     "match": {
  59.       "content": {
  60.         "query": "awe wes eso ome sea ear arc rch",
  61.         "analyzer": "whitespace",
  62.         "minimum_should_match": "100%"
  63.       }
  64.     }
  65.   }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement