Utilisé elasticsearch version 2.4.1, lucene version 5.5.2.Rechercher Elasticsearch 2.4 si un champ contient une chaîne particulière
Problème Je suis face est que j'ai des documents comme ci-dessous:
{
"_index": "_myIndex",
"_type": "_mytype",
"_id": "76be12a4-037d-45e2-8941-8228287fcae4",
"_source": {
"eventID": "76be12a4-037d-45e2-8941-8228287fcae4",
"receivedTimestamp": 1497591418899,
"producerName": "_myProducer",
"eventName": "event1",
"message": "This is a query regarding elasticsearch. Return me this document if it contains elasticsearch",
"timestamp": "1497591418000"
}
}
Quand je recherche l'aide ci-dessous requête Je ne reçois pas le document à la place que je vois
curl -XGET 'http://localhost:9200/_myIndex/_search?pretty' -H 'Content-Type: application/json' -d '{ "query": { "match": { "message": "elasticsearch" }}}'
Returns:
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
Toute aide serait apprécié. Je suis novice à Elasticsearch.
La cartographie de l'indice:
{
"_myIndex": {
"mappings": {
"_myType": {
"properties": {
"eventID": {
"type": "string",
"index": "not_analyzed"
},
"eventName": {
"type": "string",
"index": "not_analyzed"
},
"message": {
"type": "string",
"index": "no"
},
"producerName": {
"type": "string",
"index": "not_analyzed"
},
"query": {
"properties": {
"bool": {
"properties": {
"must": {
"properties": {
"range": {
"properties": {
"timestamp": {
"properties": {
"gte": {
"type": "string"
},
"lt": {
"type": "string"
}
}
}
}
},
"term": {
"properties": {
"eventName": {
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"receivedTimestamp": {
"type": "long"
},
"size": {
"type": "long"
},
"timestamp": {
"type": "long"
}
}
}
}
}
}
Pouvez-vous partager la cartographie de votre index: 'boucle -XGET localhost: 9200/_myIndex' – Val
@val mis à jour la question de la cartographie. – thomas