Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-16920

Add NXQL HINT syntax to enable Elasticsearch index selection

    XMLWordPrintable

    Details

      Description

      Sometime we need a different mapping between Nuxeo field and Elasticsearch index. For instance if we want to use an ngram index on dc:title instead of a fulltext search.

      A solution is to add an Elasticsearch hints syntax similar to Oracle,
      using 3 keywords INDEX, ANALYZER and OPERATOR:

      -- Use an explicit ES field
      SELECT * FROM Document WHERE /*+ES: INDEX(dc:title.ngram) */ dc:title = 'foo'
      
      -- Use fulltext search on explicit list of ES fields, here boosting dc;title
      SELECT * FROM Document WHERE /*+ES: INDEX(dc:title.fulltext^3,dc:description.fulltext) */ ecm:fulltext = 'foo'
      
      -- Use ES operators not present in NXQL
      SELECT * FROM Document WHERE /*+ES: OPERATOR(regex) */ dc:title = 's.*y'
      SELECT * FROM Document WHERE /*+ES: OPERATOR(fuzzy) */ dc:title = 'zorkspaces'
      SELECT * FROM Document WHERE /*+ES: OPERATOR(common) */ dc:title = 'this is bonsai cool'
      
      -- Use ES query_string on multiple fields using a fulltext analyzer
      SELECT * FROM Document WHERE /*+ES: INDEX(dc:title.fulltext,dc:description.fulltext) ANALYZER(fulltext) OPERATOR(query_string) */ dc:title = 'this AND that OR thus'
      
      

      See documentation
      http://doc.nuxeo.com/x/uItH#NXQL-ElasticsearchNXQLHints

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: