Norman Light
Norman Light

Reputation: 81

language analyzer not working with span query elasticsearch?

I have an index my_index and a type my_type

{
  "mappings": {
    "my_type": {
      "properties": {
        "my_text": {
          "type": "text",
          "analyzer": "spanish"                 
        }
      }
    }
  }
}

then I want to search for 2 or more words, with, or without gaps but in the specified order.

For that I wrote the following query:

{
  "query": {
    "span_near": {
      "clauses": [
        {
          "span_term": {
            "my_text": "creación"
          }
        },
        {
          "span_term":  {
            "my_text": "fundación"
          }
        }
      ],
      "slop":4,
      "in_order": true
    }
  }    
}

The query is not producing results. But if i search "creacion" and "fundacion" (without diacritics) the query show results. If i do a phrase_query "creación de una fundación" produces results, so i think there is not support for language analyzers in span queries?

Thanks in advance...

Upvotes: 4

Views: 793

Answers (1)

Norman Light
Norman Light

Reputation: 81

Span queries are NOT analyzed, nor stemmed. They are LOW level queries exposed by the API and you need to know how it is stored before u do the SPAN query.

Upvotes: 4

Related Questions