Query terms search miss content depending on what is searched

Hello, I have a strange issue with the ES query search: When searching for an array of ID, some of them will be skipped, but looking for those IDs individually of in a different array will return the skipped IDs correctly. For example, with the following search:

localhost:9200/myIndex/_search?pretty

{
  "query": {
    "terms": {
      "cid": ["5705179", "5705302", "5705191", "5725846", "5704789", "5705284", "5705239", "5704798", "5705038", "5705254", "5705278", "5706640"]
    }
  }
}

The first ID 5705179 will not be found. However, if I remove any of the following IDs and search again, it will be listed.

Do you know what could cause this issue ? Thank you for your help.

This is what data is in the skipped ID:

    hits": [
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705179/fussball/bundesliga/2021/02/fc-bayern-bvb-stuermer-erling-haaland-folgt-auf-robert-lewandowski-kommentar",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:39.898Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705179,
                    "url": "/fussball/bundesliga/2021/02/fc-bayern-bvb-stuermer-erling-haaland-folgt-auf-robert-lewandowski-kommentar",
                    "@version": "1",
                    "short_url": null
                }
            }

And in one of the other content:

    {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705284/us-sport/nhl/2021/02/nhl-goalie-rask-geht-versehentlich-vom-eis-unterhaltungsbranche",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:22.156Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705284,
                    "url": "/us-sport/nhl/2021/02/nhl-goalie-rask-geht-versehentlich-vom-eis-unterhaltungsbranche",
                    "@version": "1",
                    "short_url": null
                }
            },

By default 10 results are returned and you have more than 10 terms. Can you show the full response which should show number of hits?

Hello, thank you for your answer. The query returns all other 13 results:

    {
    "took": 554,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 13,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705284/us-sport/nhl/2021/02/nhl-goalie-rask-geht-versehentlich-vom-eis-unterhaltungsbranche",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:22.156Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705284,
                    "url": "/us-sport/nhl/2021/02/nhl-goalie-rask-geht-versehentlich-vom-eis-unterhaltungsbranche",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705278/us-sport/nba/2021/02/nba-mark-cuban-von-dallas-mavericks-aeussert-sich-zur-hymnen-debatte",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:21.790Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705278,
                    "url": "/us-sport/nba/2021/02/nba-mark-cuban-von-dallas-mavericks-aeussert-sich-zur-hymnen-debatte",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705254/kampfsport/wrestling/2021/02/aew-dynamite-knall-in-jerichos-inner-circle-mjf-vergrault-sammy-guevara",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:20.297Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705254,
                    "url": "/kampfsport/wrestling/2021/02/aew-dynamite-knall-in-jerichos-inner-circle-mjf-vergrault-sammy-guevara",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705239/us-sport/nba/2021/02/nba-luka-doncic-fuehrt-dallas-mavericks-zum-sieg-aerger-bei-atlanta-hawks",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:19.223Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705239,
                    "url": "/us-sport/nba/2021/02/nba-luka-doncic-fuehrt-dallas-mavericks-zum-sieg-aerger-bei-atlanta-hawks",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5706640/fussball/2-bundesliga/2021/02/2-liga-bochum-jagt-den-hsv",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:35.417Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5706640,
                    "url": "/fussball/2-bundesliga/2021/02/2-liga-bochum-jagt-den-hsv",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705038/wintersport/2021/02/dsv-will-ex-biathleten-um-dahlmeier-fuer-nachwuchsfoerderung-gewinnen",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:22.803Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705038,
                    "url": "/wintersport/2021/02/dsv-will-ex-biathleten-um-dahlmeier-fuer-nachwuchsfoerderung-gewinnen",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5704789/tennis/grand-slams/2021/02/tennis-neuer-podcast-cross-court-auf-sport1-zu-den-australian-open",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:23.237Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5704789,
                    "url": "/tennis/grand-slams/2021/02/tennis-neuer-podcast-cross-court-auf-sport1-zu-den-australian-open",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705302/internationaler-fussball/premier-league/2021/02/england-pep-guardiola-und-manchester-city-mit-historischer-siegesserie",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:23.278Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705302,
                    "url": "/internationaler-fussball/premier-league/2021/02/england-pep-guardiola-und-manchester-city-mit-historischer-siegesserie",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5704798/tennis/grand-slams/2021/02/australian-open-jessica-pegula-schlaegt-azarenka-und-mischt-tennis-szene-auf",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:23.804Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5704798,
                    "url": "/tennis/grand-slams/2021/02/australian-open-jessica-pegula-schlaegt-azarenka-und-mischt-tennis-szene-auf",
                    "@version": "1",
                    "short_url": null
                }
            },
            {
                "_index": "url_alias",
                "_type": "_doc",
                "_id": "5705191/us-sport/nfl/2021/02/brady-grosser-wurf-bei-der-siegesparade",
                "_score": 1.0,
                "_source": {
                    "@timestamp": "2021-04-14T13:07:40.733Z",
                    "modification_time": "2021-02-16T11:38:59.000Z",
                    "lang_id": "de",
                    "cid": 5705191,
                    "url": "/us-sport/nfl/2021/02/brady-grosser-wurf-bei-der-siegesparade",
                    "@version": "1",
                    "short_url": null
                }
            }
        ]
    }
}

The query matched 13 documents but the results array by default only shows 10 of these. If you want to see all you need to provide a size parameter with a larger value.

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