Note that there are some explanatory texts on larger screens.

plurals
  1. POElasticSearch mapping doesn't work
    text
    copied!<p>I'm trying to set up an ElasticSearch index with different analyzers for the individual fields. However, I can't seem to find a way to set field-specific analyzers; here's how I create my (test) index:</p> <pre><code>curl -XPOST localhost:9200/twitter curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "properties" : { "message" : { "type" : "string", "search_analyzer" : "snowball", "index_analyzer" : "snowball" } } } }' </code></pre> <p>If I read the documentation correctly, then this should create the index 'twitter' with the type 'tweet', and content for the 'message' field should be analyzed through the snowball stemming analyzer. To test for this, I tried the following queries:</p> <pre><code>curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ "message" : "Look, a fighting War-Unicorn!" }' curl -XGET localhost:9200/twitter/_search?q=fight </code></pre> <p>If I'm not mistaken, then this should return a hit, as fight is the stem for fighting; the problem is, it doesn't, I'm getting zero hits. It appears as if ElasticSearch ignores the mapping entirely (even though ElasticSearch accepts all of these queries, as I get 'ok' back for each of them.)</p> <p>I've already tried replacing the default analyzer with a snowball analyzer, and then it works; thing is, I totally need to have field-specific analyzers, so this isn't going to help me. I also tried different analyzers and things like setting "index" to "no", but to no avail.</p> <p>What am I doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload