Index not_analyzed configuration not being applied


#1

Hi there!

We are in the process of switching from 1.7 to 2.1.

As we have a few things to change in our indexes, we decided to update the mapping, and we are seeing strange things.

We have some fields that should not be analyzed, so we have set up a template that is being applied to our new index, with this:

"mappings": {
    "fb_post": {
      "properties": {
        "tags": {
          "type": "string",
          "index": "not_analyzed"
        },

If we test if this is working, it is not:

POST /facebook_messages_test/_analyze?field=fb_post.tags

with the body

abcd. era-76

we are getting this response:

{
  "tokens": [
    {
      "token": "abcd",
      "start_offset": 0,
      "end_offset": 4,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "era",
      "start_offset": 6,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 1
    },
    {
      "token": "76",
      "start_offset": 10,
      "end_offset": 12,
      "type": "<NUM>",
      "position": 2
    }
  ]
}

And not the full element.

We have the same problem with a custom analyzer that does a keyword and then a lowercase filter. But I think this is more important.

Do you know what might be happening?

PS: the mappings are correct as we see our indexed using the template, with the correct index: not_analyze field

Thanks in advance!


(Shaunak Kashyap) #2

Try removing the type prefix from the field query parameter to the _analyze API call. So instead of fb_post.tags, try using just tags.


#3

Hi,

thanks for the super quick answer.

That works. I was using the kopf plugin, and that's the call that it is doing to the backend. Making a request by hand with the field as just the name of the field, it works.

I will open an issue to their plugin, as I got this confussion from them.

Thanks!

Edit: This is the issue on kopf repo https://github.com/lmenezes/elasticsearch-kopf/issues/332


(system) #4