daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jan 16th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. url -XPUT 'localhost:9200/pet_index?pretty' -H 'Content-Type: application/json' -d'
  2. { "mappings": {
  3.     "pet_owner": {
  4.       "properties": {
  5.         "name":     { "type": "text"  },
  6.         "age":      { "type": "integer" },  
  7.         "pet":    { "type": "text"  },
  8.         "created":  {
  9.           "type":   "date",
  10.           "format": "strict_date_optional_time||epoch_millis"
  11.         }
  12.       }
  13.     }
  14.   },
  15.     "settings": {
  16.         "index" : {
  17.             "analysis" : {
  18.                 "analyzer" : {
  19.                     "search_synonyms" : {
  20.                         "tokenizer" : "whitespace",
  21.                         "filter" : ["graph_synonyms"]
  22.                     }
  23.                 },
  24.                 "filter" : {
  25.                     "graph_synonyms" : {
  26.                         "type" : "synonym_graph",
  27.                         "synonyms_path" : "analysis/synonym2.txt"
  28.                     }
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
  34. '
  35. curl -XGET 'localhost:9200/pet_index/_search?pretty' -H 'Content-Type: application/json' -d'
  36. {
  37. "query" : {
  38.        "match" : {
  39.               "pet" : {
  40.                      "query":"pet",
  41.                      "analyzer": "search_synonyms"
  42.                      }
  43.               }
  44.        }
  45. }
  46. '
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top