# What's the difference between es's match search and luence search

**URL:** <https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095>\
**Category:** Elasticsearch\
**Created:** [November 20, 2020, 9:46am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095 "2020-11-20T09:46:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 20, 2020, 9:46am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/1 "2020-11-20T09:46:02Z")

</div>

it's can get when i search use es match query.the match query is like

```auto
 {"query": 
    {
        "bool": {
       "must": [
          {
             "match": {
             "message": "too long"}
          }],
         "must_not": [],
     "should": []}},
     "from": 0,
     "size": 10,
     "sort": [],
     "aggs": { }
}

```

but i can't get when i use luence query like "\_search?q=message:"too long"&size=1000".

The content of "message" is "java.util.concurrent.TimeoutException: Remote system has been silent for too long. (more than 48.0 hours)".

but it's all can get when i search info "Remote system".

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 20, 2020, 9:54am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/2 "2020-11-20T09:54:07Z")

</div>

Works for me here when I use the default mapping:

```
DELETE test
POST test/_doc/1
{
 "message": "java.util.concurrent.TimeoutException: Remote system has been silent for too long. (more than 48.0 hours)"
}
GET test/_search?q=message:"too long"&size=1000

```

This matches the doc, as does the longer `match` query example you shared.  
This is probably down to your mapping. Can you share your mapping configuration?

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 20, 2020, 10:16am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/3 "2020-11-20T10:16:23Z")

</div>

thanks for you answer。  
my mapping is

```auto
"mappings": {
"_default_": { "dynamic_templates": [{ "string_fields": { "mapping": { "type": "keyword"},"match_mapping_type": "string"}}],"_all": { "enabled": false},"properties": { "@timestamp": { "type": "date"},"message": { "norms": false,"similarity": "boolean","analyzer": "ik_max_word","type": "text"}}},
"doc": { "dynamic_templates": [{ "string_fields": { "mapping": { "type": "keyword"},"match_mapping_type": "string"}}],"_all": { "enabled": false},"properties": { "logType": { "type": "keyword"},"log": { "properties": { "file": { "properties": { "path": { "type": "keyword"}}},"offset": { "type": "long"}}},"index_day": { "type": "keyword"},"message": { "norms": false,"similarity": "boolean","analyzer": "ik_max_word","type": "text"},"subTaskId": { "type": "keyword"},"tags": { "type": "keyword"},"@timestamp": { "type": "date"},"logLevel": { "type": "keyword"},"@version": { "type": "keyword"},"host": { "properties": { "name": { "type": "keyword"}}},"taskName": { "type": "keyword"},"applicationId": { "type": "keyword"},"containerId": { "type": "keyword"},"fields": { "properties": { "clusterId": { "type": "long"}}}}}
}

```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 20, 2020, 10:28am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/4 "2020-11-20T10:28:09Z")

</div>

Thanks. You're using an analyzer called `ik_max_word` which I can't see and will be defined in your settings.  
One of the ways of debugging this and other issues yourself is to use the [\_analyze](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html) api to see how the document and query is tokenized and the [\_explain](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html) API to show how a query does (or doesn't) match a doc.

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 23, 2020, 2:43am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/5 "2020-11-23T02:43:25Z")

</div>

I try it,  
The analyze is

```auto
{
    "tokens": [
        {
            "token": "too",
            "start_offset": 0,
            "end_offset": 3,
            "type": "ENGLISH",
            "position": 0
        },
        {
            "token": "long",
            "start_offset": 4,
            "end_offset": 8,
            "type": "ENGLISH",
            "position": 1
        }
    ]
}

```

the explain is

```auto
{
    "_index": "test",
    "_type": "_doc",
    "_id": "xHPL8nUBlF-KtMFxz-1J",
    "matched": false,
    "explanation": {
        "value": 0.0,
        "description": "Failure to meet condition(s) of required/prohibited clause(s)",
        "details": [
            {
                "value": 0.0,
                "description": "no match on required clause (message:\"too long\")",
                "details": [
                    {
                        "value": 0.0,
                        "description": "no matching phrase",
                        "details": []
                    }
                ]
            },
            {
                "value": 0.0,
                "description": "no match on required clause (MatchNoDocsQuery(\"Type list does not contain the index type\"))",
                "details": [
                    {
                        "value": 0.0,
                        "description": "MatchNoDocsQuery(\"Type list does not contain the index type\") doesn't match id 0",
                        "details": []
                    }
                ]
            }
        ]
    }
}

```

it's amazing that The content has “too long ” phrase.

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 23, 2020, 2:50am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/6 "2020-11-23T02:50:33Z")

</div>

The analyze is

```auto
{
    "tokens": [
        {
            "token": "too",
            "start_offset": 0,
            "end_offset": 3,
            "type": "<ALPHANUM>",
            "position": 0
        },
        {
            "token": "long",
            "start_offset": 4,
            "end_offset": 8,
            "type": "<ALPHANUM>",
            "position": 1
        }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 23, 2020, 9:52am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/7 "2020-11-23T09:52:32Z")

</div>

Thanks. Can you share the full explain request which includes the query?

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 23, 2020, 10:44am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/8 "2020-11-23T10:44:05Z")

</div>

Thanks.  
The full explain request is

```auto
http://ip:port/test/_doc/xHPL8nUBlF-KtMFxz-1J/_explain?q=message:"too long"

```

My es version is 6.8

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 23, 2020, 10:50am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/9 "2020-11-23T10:50:25Z")

</div>

It looks like your mapping declares a document type `doc` but your query url references the type `_doc`

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 23, 2020, 12:06pm UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/10 "2020-11-23T12:06:14Z")

</div>

Sorry, the "\_doc" is error. my type is "test",the data is like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b35367340f7307b41dbed90afc84acc65fd4d54f.png)

I try request again, like this:

```auto
http://sloth0.dg.163.org:9201/test/test/xHPL8nUBlF-KtMFxz-1J/_explain?q=message:"too long"

```

The result is:

```auto
{
    "_index": "test",
    "_type": "test",
    "_id": "xHPL8nUBlF-KtMFxz-1J",
    "matched": false,
    "explanation": {
        "value": 0.0,
        "description": "no matching phrase",
        "details": []
    }
}

```

I also can't get more information

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 23, 2020, 12:15pm UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/11 "2020-11-23T12:15:52Z")

</div>

My output from the analyze API is identical to yours and yet the query below works OK in 6.6. and 7.10.  
Can you try run this and compare? Then try it using your Analyzer..

```
DELETE test
POST test/_doc/1
{
 "message": "java.util.concurrent.TimeoutException: Remote system has been silent for too long. (more than 48.0 hours)"
}
GET test/_analyze
{
  "field": "message", 
  "text": "too long"
}
GET test/_doc/1/_explain?q=message:"too long"
```

---

<div class="post-metadata">

**Author:** ![ocean\_shi](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@ocean\_shi](https://discuss.elastic.co/u/ocean_shi)\
**Post date:** [November 24, 2020, 2:03am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/12 "2020-11-24T02:03:37Z")

</div>

I have a try, the result is:

 ![截屏2](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0eae4fef1830f5c5a9558335ad8005a4be5a93a6.png) ![截图1](https://us1.discourse-cdn.com/elastic/original/3X/4/d/4d596e79009f766e5c6d27b4ca94c61b8e9c7296.png) ![截屏3](https://us1.discourse-cdn.com/elastic/original/3X/0/6/06b47c15f023e84054779d08b74ea2ce80d6dd2c.png)

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 24, 2020, 8:25am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/13 "2020-11-24T08:25:17Z")

</div>

Did my example (with the default analyzer) work?  
What is the output of the analyze api using your analyzer and the string that is your document’s message?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 22, 2020, 8:25am UTC](https://discuss.elastic.co/t/whats-the-difference-between-ess-match-search-and-luence-search/256095/14 "2020-12-22T08:25:35Z")

</div>

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