Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9875

Prefix query on a Long, analyzed field fails when executed over Elastic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • elastic-search, indexing
    • None

    Description

      Index definition:

      "testIndex": {
       "jcr:primaryType": "nt:unstructured",
       "analyzed": true,
       "type": "Long",
       "name": "propa"
      }
      

      Data:

      /test/a    [propa = 1234 ]
      /test/b    [propa = "1234"]
      /test/c    [propa = "1234a"]
      

      The following query executed with Elastic:

      /jcr:root//*[jcr:contains(@propa, '123*')]
      

      fails with:

      14:28:51.713 ERROR [I/O dispatcher 1] ElasticResultRowAsyncIterator.java:326 Error retrieving data from Elastic: closing scanner, notifying listeners
      co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/search] failed: [search_phase_execution_exception] all shards failed
      	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:281)
      	at co.elastic.clients.transport.rest_client.RestClientTransport.access$200(RestClientTransport.java:63)
      

      The detailed error is not shown in the logs, but can be found by repeating the query directly to Elastic:

      "Can only use prefix queries on keyword, text and wildcard fields - not on [propa] which is of type [long] 

      The same query executes correctly with Lucene.

      Analysis

      The root cause of the problem is that the Elastic plugin does not create a field for full text search on typed properties:

      https://github.com/apache/jackrabbit-oak/blob/e13d6c7dc5df3087955a85cb28f5bfb8b6171977/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java#L197

      Therefore, it is not possible to run full text queries on this index.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nuno.santos Nuno Santos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: