Suggestion Queries with numeric


(Erich Beyrent) #1

Issue:

Hi there! I have added a completion field to my index mapping, and when I index my documents, they look like this:

{
  "_index": "elasticsearch_index_chemdb_chemicals",
  "_type": "chemicals",
  "_id": "entity:node/454:en",
  "_version": 1,
  "_score": 0,
  "_source": {
    "_language": "en",
    "multi_field_suggest": [
      {
        "input": [
          "110-13-4",
          "1,2-Diacetylethane",
          "2,5-Diketohexane",
          "Acetone, acetonyl-",
          "Acetonyl acetone",
          "Acetonylacetone",
          "Diacetonyl",
          "alpha,beta-Diacetylethane",
          "2,5-Hexanedione"
        ],
        "weight": 20
      }
    ]
  }
}

When I try to do a suggest query against the multi_field_suggest field using a non-numeric string:

{
  'suggest': {
    'multi_field_suggest': {
      'prefix' : 'ars',
      'completion' : {
        'field' : 'multi_field_suggest',
        'size' : 20
      }
    }
  }
}

This gives me back expected results. However, if I try the same query where prefix = "110", I get no results.

{
  'suggest': {
    'multi_field_suggest': {
      'prefix' : '110',
      'completion' : {
        'field' : 'multi_field_suggest',
        'size' : 20
      }
    }
  }
}

I was expecting to get back a document that matched "110-13-4”.

Is there a configuration change that needs to be made in order to get this to work, or perhaps a change to the way I'm doing the query?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.