0

I'm trying to write a custom analyzer with its own filter and char_filter. It would help me if I could figure out how to see the tokens emitted by the analyzer/filter/char_filter combo.

Is there an API query I can use to inspect the tokens emitted from a given string with a custom analyzer, filter, and char_filter?

MeowCode
  • 1,053
  • 2
  • 12
  • 29
  • This answer might help: http://stackoverflow.com/questions/27267185/is-there-a-elasticsearch-plugin-similar-to-the-solr-analysis-tool/36832209#36832209 – Val Nov 02 '16 at 13:55
  • Getting python/pip going has been a significant barrier... although if something else doesn't work out, I will try that again! – MeowCode Nov 02 '16 at 19:52

1 Answers1

1

You can use this query to check tokens emitted for any field for a given doc already saved in elastic

curl 'http://localhost:9200/test-idx/_search?pretty=true' -d '{
  "query": {
    "match_all": {},
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "_id": "1770"
              }
            }
          ]
        }
      }
    }
  },
  "script_fields": {
    "terms": {
      "script": "doc[field].values",
      "params": {
        "field": "input"
      }
    }
  }
}

Also to find token emitted for a string by any custom analyzer on the fly you can use this.

GET autosuggest_index_alllocations1/_analyze?analyzer=index_analyzerV2&text=healthy tiffins
user3775217
  • 4,675
  • 1
  • 22
  • 33
  • GET autosuggest_index_alllocations1/_analyze?analyzer=index_analyzerV2&text=healthy tiffins worked for me. – MeowCode Nov 02 '16 at 19:57