How can I create a mapping structure by using nested property for created index? I got an error below. This url produces below result:
http://xxx:9200/usereventsreduced-2020/event/_search?pretty=true
UrlQueryString is a nested one! we need describe it is nested.
{
"took": 42,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 7108,
"max_score": 7.4923043,
"hits": [
{
"_index": "usereventsreduced-2020",
"_type": "event",
"_id": "omHM3G8BiazbIYmiMj35",
"_score": 7.4923043,
"_source": {
"UserId": "",
"SessionId": "",
"LogLevel": "Error",
"CorrelationId": "d49ad78d-1f38-4fed-ae47-9d6768402212",
"UrlMethod": "GET",
"Data": "",
"UrlQueryString": {
"smId": "df178847-c8e2-4434-b779-eeb248b9bebb"
},
"UrlPath": "/PaymentResultCommon",
"LogSource": "B2EUi",
"LogDate": "2020-01-25T13:01:14.4634937Z",
"Environment": "Production-K8S"
}
},
{
"_index": "usereventsreduced-2020",
"_type": "event",
"_id": "1V9W3G8BiazbIYmi4uwD",
"_score": 7.4923043,
"_source": {
"UserId": "",
"SessionId": "",
"LogLevel": "Error",
"CorrelationId": "959d767d-cd66-4878-a5ca-e8e887aeec95",
"UrlMethod": "GET",
"Data": "",
"UrlQueryString": {
"b": "ce5cb7ed-280d-419a-9906-25004b799750",
"t": "e05879ec-668b-41dc-9b77-09072ab62ef4"
},
"UrlPath": "/PaymentCallBack",
"LogSource": "B2EUi",
"LogDate": "2020-01-25T10:53:39.2500748Z",
"Environment": "Production-K8S"
}
},
{
"_index": "usereventsreduced-2020",
"_type": "event",
"_id": "_YDh528BiazbIYmiU_nH",
"_score": 7.4923043,
"_source": {
"UserId": "",
"SessionId": "",
"LogLevel": "Error",
"CorrelationId": "6417519f-6f61-496d-8eba-3dd32b5c1ddf",
"UrlMethod": "GET",
"Data": "",
"UrlQueryString": {
"b": "eef54432-df76-40f4-9a7b-aa447b20eb27",
"t": "97d3734c-203f-48a4-ac9f-77d575528121"
},
"UrlPath": "/PaymentCallBack",
"LogSource": "B2EUi",
"LogDate": "2020-01-27T16:40:51.0060448Z",
"Environment": "Production-K8S"
}
}
]
}
}
But below code doesn't work because I have to describe my paping with nested object. UrlQueryString is a nested one.
{
"query": {
"nested" : {
"path" : "UrlQueryString",
"query" : {
"bool" : {
"must" : [
{ "match" : {"UrlQueryString.parameter" : "grand-urfa-hotel"} }
]
}
}
}
}
}
My Mapping code :
PUT /usereventsreduced-*/_mapping/event
{
"mappings" : {
"properties" : {
"UrlQueryString" : {
"type" : "nested"
}
}
}
}
Result:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {properties={UrlQueryString={type=nested}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {properties={UrlQueryString={type=nested}}}]"
},
"status": 400
}