简体   繁体   中英

Is it possible to set a custom analyzer to not tokenize in elasticsearch?

I want to treat the field of one of the indexed items as one big string even though it might have whitespace. I know how to do this by setting a non-custom field to be 'not-analyzed', but what tokenizer can you use via a custom analyzer?

The only tokenizer items I see on elasticsearch.org are:

  • Edge
  • NGram
  • Keyword
  • Letter
  • Lowercase
  • NGram
  • Standard
  • Whitespace
  • Pattern
  • UAX URL Email
  • Path
  • Hierarchy

None of these do what I want.

The Keyword tokenizer is what you are looking for.

The Keyword tokenizer doesn't really do:

When searching, it'll tokenize the entire query string into a single token, making text queries behave like a term query.

The issue I run into is that I want to add filters and then search indexed keywords in a long text (Keyword assignment). I would say there's no tokenizer that could do this, and that the normalizer can't accept necessary filters. The workaround for me is to prepare the text before feeding it to elasticsearch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM