user2348668
user2348668

Reputation: 768

Elasticsearch _mapping API is not telling me which fields are not analyzed

I am trying to stop elasticsearch from analyzing some fields in my documents. I posted this mapping:

{
  "properties" : {
     "f1" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     },
     "f2" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     },
     "f3" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     }
  }
} 

Then I ping the mapping endpoint and it doesn't tell me if those fields are analyzed or not:

{
  "myindex" : {
    "mappings" : {
      "mytype" : {
        "properties" : {
          "f1" : {
            "type" : "keyword",
            "include_in_all" : false
          },
          "f2" : {
            "type" : "keyword",
            "include_in_all" : false
          },
          "f3" : {
            "type" : "keyword",
            "include_in_all" : false
          }
        }
      }
    }
  }
}

In the examples I have seen querying _mapping API seems to tell what fields are analyzed or not.

Upvotes: 1

Views: 31

Answers (1)

Roeland Van Heddegem
Roeland Van Heddegem

Reputation: 1735

In elasticsearch 5.0 and later there's a new way of separating analyzed and non-analyzed content:

But, to summarize:

  • keyword is not analyzed
  • text is analyzed

and the index property that had 3 values: "no","analyzed","not-analyzed" is now simplified to just "yes" and "no"

Upvotes: 1

Related Questions