Hi everyone,

I am relatively new to elasticsearch and am having issues with getting my 
synonym filter to work. Can you take a look at the settings and tell me 
where I am going wrong?

I am expecting the search for "aids" to match the search results if I were 
to search for "retrovirology", but this is not happening.

Thanks!

curl -XDELETE "http://localhost:9200/personsearch";

curl -XPUT "http://localhost:9200/personsearch"; -d'
{
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "XYZSynAnalyzer": {
            "tokenizer": "standard",
            "filter": [
              "XYZSynFilter"
            ]
          }
        },
        "filter": {
          "XYZSynFilter": {
            "type": "synonym",
            "synonyms": [
              "aids, retrovirology"
            ]
          }
        }
      }
    }
  },
  "mappings": {
    "xyzemployee": {
      "_all": {
        "analyzer": "XYZSynAnalyzer"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "middleName": {
          "type": "string",
          "include_in_all": false,
          "index": "not_analyzed"
        },
        "specialty": {
          "type": "string",
          "analyzer": "XYZSynAnalyzer"
        }
      }
    }
  }
}'

curl -XPUT "http://localhost:9200/personsearch/xyzemployee/1"; -d'
{
  "firstName": "Don",
  "middleName": "W.",
  "lastName": "White",
  "specialty": "Adult Retrovirology"
}'

curl -XPUT "http://localhost:9200/personsearch/xyzemployee/2"; -d'
{
  "firstName": "Terrance",
  "middleName": "G.",
  "lastName": "Gartner",
  "specialty": "Retrovirology"
}'

curl -XPUT "http://localhost:9200/personsearch/xyzemployee/3"; -d'
{
  "firstName": "Carter",
  "middleName": "L.",
  "lastName": "Taylor",
  "specialty": "Pediatric Retrovirology"
}'

curl -XGET 
"http://localhost:9200/personsearch/xyzemployee/_search?pretty=true"; -d'
{
  "query": {
    "match": {
      "specialty": "retrovirology"
    }
  }
}'

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/2e227a33-d935-4d22-89fb-57b59358c89d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to