Request for a UUID format field on elasticsearch

I indexed such documents that were created on the fly, so I mean that a mapping was created, while new fields were created (dynamically).

{
  "user":"living_team",
  "timestamp":"2015-12-14T18:06:47.085Z",
  "matter":"snip2.PNG",
  "comment":"Archive",
  "channel":"Feina",
  "feedTypes":[
     20
  ],
  "property_general_ldate":"2015-12-14T18:06:47.085Z",
  "property_tSize":7595.0,
  "resources":[
     {
        "timestamp":"2015-12-14T16:58:00.598Z",
        "matter":"snip2.PNG",
        "comment":"Archive",
        "channel":"Feina",
        "feedType":20,
        "mime":"image/png",
        "source":{
           "sourceId":{
              "id":"C:\\Users\\Beep\\Desktop\\share\\snip2.PNG",
              "batch":"c38eec2d-a282-11e5-baf4-382c4ab9e433",
              "client":"VIM12HCNZL"
           },
           "feedType":20,
           "property_folder":"C:\\Users\\Beep\\Desktop\\share",
           "property_lastAccessFolder_ldate":1450111821506
        },
        "property_size":7595.0,
        "property_creation_ldate":"2015-12-14T16:50:20.578Z",
        "property_name":"snip2.PNG",
        "nestedResources":[

        ]
     }
  ]

}

I need to get documents: resources.source.sourceId.id is exactly "X". I tried with this query, however its results are empty.

curl -XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' -d '{
  "query":{
     "filtered":{
        "query":{
           "term":{
              "resources.source.sourceId.batch":"3fcb8905-a307-11e5-88de-382c4ab9e433"
           }
        },
        "filter":{
           "match":{
              "channel":"FeINa"
           }
        }
     }
  }
}'
+4
source share
2 answers

With regard to the same problem as in your other question , namely, that the field line resources.source.sourceId.batchhas been created as a field analyzed, and therefore, the value c38eec2d-a282-11e5-baf4-382c4ab9e433was recorded in five tokens c38eec2d, a282, 11e5, baf4, 382c4ab9e433.

- not_analyzed .

query_string :

curl -XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' -d '{
  "query":{
     "filtered":{
        "query":{
           "query_string":{
              "query": "resources.source.sourceId.batch:\"3fcb8905-a307-11e5-88de-382c4ab9e433\""
           }
        },
        "filter":{
           "match":{
              "channel":"FeINa"
           }
        }
     }
  }
}'
+9

, UUID , terms term UUID -.

... .

- :

curl -XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' -d '{
  "query":{
     "filtered":{
        "query":{
           "terms":{
              "resources.source.sourceId.batch":["3fcb8905", "a307", "11e5", "88de", "382c4ab9e433"]
           }
        },
        "filter":{
           "match":{
              "channel":"FeINa"
           }
        }
     }
  }
}'
+2

Source: https://habr.com/ru/post/1620082/


All Articles