Multi_match query issue


(Mohammed Essabri) #1

Hi Team,
I'm using ES 1.7
I have an index containing a field named proceedingslanguage which contains a language EN, FR or DE.

The following script using Curl is giving me an empty result :

curl -XGET 'http://localhost:9200/_search?pretty' -d'{
  "from" : 0,
  "size" : 6,
  "query" : {
    "filtered" : {
      "query" : {
        "bool" : {
          "must" : [ {
            "bool" : {
              "must" : {
                "multi_match" : {
                  "query" : "EN",
                  "fields" : [ "proceedingslanguage_*", "proceedingslanguage_en^5.0" ],
                  "type" : "best_fields"
                }
              }
            }
          } ]
        }
      },
      "filter" : {
        "type" : {
          "value" : "decision"
        }
      }
    }
  }
}'

Note: the same query is sending by Elasticsearch java client from an app to retrieve data by language.

The result is described below:

   {
      "took" : 10,
      "timed_out" : false,
      "_shards" : {
        "total" : 27,
        "successful" : 27,
        "failed" : 0
      },
      "hits" : {
        "total" : 0,
        "max_score" : null,
        "hits" : [ ]
      }
    }

Can you please give me a hand of help?

Thanks and best regards,
Mohammed ESSABRI


Same config and different result with Muti_match query
Search query working in One environment and not in another
(Mayya Sharipova) #2

I'm using ES 7.1

The latest version of ES available is 6.3. Are you using a master branch?

It is not very clear: do you have a single field named proceedingslanguage that has values of EN, FR, DE? Or do you have different fields named: proceedingslanguageEN, proceedingslanguageFR etc?
Also what are you trying to search for?


(Mohammed Essabri) #3

Hi @mayya,

Thank you for you response!

Sorry, it is a mistake, i wanted to write 1.7.

For your question, it is a single field named proceedingslanguage that has values of EN, FR, DE. and the application was developed by another developer, and i don't understand why the app requires "proceedingslanguage_*" where we have only proceedingslanguage in mapping.

Note that the application was already working with this configuration more than 1 year and it's working currently in some environments.

Best regards,
Mohammed ESSABRI


(Mayya Sharipova) #4

Looking at the query you posted above, it looks like there several fields for proceedingslanguage, and we are looking for EN term in all these fields.

If you have just a single field proceedingslanguage, you don't need multi_match query, you can just use term query:

"query": {
    "term" : { "proceedingslanguage" : "EN" } 
  }

(Mohammed Essabri) #5

Dear @mayya,
Thank you for your help!

I share the same idea with you, but the query is already working in another Environment.

Please note that the application is deployed in 5 environments, but this query is working only in 2 environments including prod environment.
And the client don't accept a change on the code as it's already working in PROD environment.

Best regards,
Mohammed ESSABRI


(system) #6

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