0

I use ASP.NET ElasticSearch NEST library and I have some data like below;

I would like to get the result by giving a value and a language

My purpose is to search data by using its language.

For example I give "bla" - value and "en-US" - language

ElasticSearch should search for "bla" in localizations "value" for all AND while searching it that localization's language must be "en-US" that I've given...

it matches with the file below... so that id of data must return.

{
   resource-type": false,
   value": "bla set",
   language": "en-US",
   creation-time": "...."
},

I mean if "bla" matches with wildcard "bla*" but doesn't match with language that I give, then it shouldn't return.

  hits : [
  "total": 24,
  "max_score": 1,
  {
    "_index": "blabla",
    "_type": "blablamodel",
    "_id": "12",
    "_score": 1,
    "_source": {
      "id": 12,
      "name": "info",
      "localizations": [
        {
          "resource-type": false,
          "value": "bla set",
          "language": "en-US",
          "creation-time": "...."
        },
        {
          "resource-type": false,
          "value": "www value es",
          "language": "es-ES",
          "creation-time": "...."
        },
        ... other languages ...
        ... 
      ]
    }
  },
  {
    "_index": "blabla",
    "_type": "blablamodel",
    "_id": "13",
    "_score": 1,
    "_source": {
      "id": 13,
      "name": "info_two",
      "localizations": [
        {
          "resource-type": false,
          "value": "add mnb",
          "language": "en-US",
          "creation-time": "..."
        },            
        {
          "resource-type": false,
          "value": "asd value es",
          "language": "es-ES",
          "creation-time": "...."
        },
        ... other languages ...
        ... 
      ]
    }
  },
  ...
  ]
serhatyt
  • 180
  • 2
  • 14
  • I've solved this problem by using Nested type for localizations. Then you search for multiple properties... – serhatyt Mar 28 '23 at 12:50

0 Answers0