-
-
Save markharwood/881a91f3b25a352fe3578c7f44ccde7a to your computer and use it in GitHub Desktop.
Example encoding of multi-value annotated text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example multi-value annotated text | |
DELETE test1 | |
PUT test | |
{ | |
"settings": { | |
"number_of_shards": 1 | |
}, | |
"mappings": { | |
"properties":{ | |
"text":{ | |
"type":"annotated_text" | |
} | |
} | |
} | |
} | |
POST test/_doc/1 | |
{ | |
"text":"he had a meeting with the [President of Mexico](Andrés+Obrador&Mexico) today" | |
} | |
GET test/_search | |
{ | |
"query": { | |
"span_near": { | |
"clauses": [ | |
{ | |
"span_or": { | |
"clauses": [ | |
{ | |
"span_term": { | |
"text": { | |
"value": "met" | |
} | |
} | |
}, | |
{ | |
"span_term": { | |
"text": { | |
"value": "meeting" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"span_term": { | |
"text": { | |
"value": "Andrés Obrador" | |
} | |
} | |
} | |
], | |
"slop": 3, | |
"in_order": false | |
} | |
}, | |
"highlight": { | |
"fields": { | |
"text": { | |
"type": "annotated" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment